Skip to content

Code Log

Menu: Development → Code Log
Deep link: /_Admin/development/code-log?SiteId={siteGuid}

View runtime logs from site KScript / code execution: filter by log level, time, TraceId, and keywords, and open single-entry details. Unlike operation logs (content change audit), this page is for runtime diagnostics.

Each list entry comes from k.logger calls in scripts; the admin does not support manually creating logs — only query, filter, and view details.

Log source (k.logger)

Write logs in Code, API, page scripts, and other KScript, for example:

ts
k.logger.information('Payment.Callback', `orderId=${orderId}`)
k.logger.error('Payment.Callback', JSON.stringify(err))
k.logger methodAdmin tab / levelList Category columnList Message column
debug()Debug · Debug1st parameter category (optional)Message body
information()Information · InformationSame as aboveSame as above
warning()Warning · WarningSame as aboveSame as above
error()Error · ErrorSame as aboveSame as above
critical()Critical · CriticalSame as aboveSame as above

With a single argument, that argument is the message and category is empty. Objects must be JSON.stringify()'d before writing.

Multiple logs in the same HTTP request often share a TraceId (useful for chaining in the admin). Scripts can also query with k.logger.query() using the same parameters as the filter bar and pagination below.

When header Enable (codeLogSettings.enable) is off, the site stops collecting new k.logger logs; existing historical week data can still be viewed by switching Week.

Permissions

Menu permission: code·log. Enable Development → Code Log in Edit Menu (advanced).

How to Open

  1. In Edit Menu, enable Development → Code Log.
  2. Open Development → Code Log in the left sidebar.
Code log page overview
ControlDescription
EnablecodeLogSettings.enable; toggling immediately calls saveSite; when off, new k.logger logs are not written/collected
WeekSelect log partition week (weekname, options from getWeeks); switching refreshes the list
Code log header: enable and week

Log level tabs

Horizontal tabs filter level (hidden-style tabs, level switch only):

TabQuery level
AllNo level filter
DebugDebug
InformationInformation
WarningWarning
ErrorError
CriticalCritical
Code log level tabs

Filter bar

ControlDescription
Date/time rangestartDate / endDate (formatted to site time for query)
TraceIdExact trace for one request chain (debounced refresh)
Keywordkeyword, matches log body, etc. (debounced)
Code log filters: time, TraceId, keyword

Log list

Paginated table (default 30 per page, sorted by creationDate):

ColumnDescription
Levellevel
Date/timecreationDate
TraceIdRequest trace Id
Categorycategory
Messagemessage summary (truncated if long)
DetailsEye icon opens detail dialog
Code log list

Detail dialog

Shows TraceId, Date/time, Level, Category, and full Message body (<pre> preserves line breaks).

Code log detail dialog
DocDescription
k.loggerLog and query (required for development)
Development overviewDevelopment menu index
CodeCode file editing
Operation logsSite object change audit