Configure logging
Set the process-wide logging options in the[Log] section:
The defaults are
Format = "json" and Level = "info". Level filtering is
inclusive: warn emits warnings and errors, while debug emits every level.
The values are case-insensitive.
Configuration errors are reported when the configuration is loaded. At
startup, invalid logging settings cause the Kernel to use its defaults. During
a reload, an invalid configuration leaves the current configuration in effect.
Changes to [Log] take effect when the Kernel creates its logger at startup;
reloading the configuration updates runtime settings such as plugins, but does
not replace the logger that is already running.
Common fields
Every Kernel log identifies its origin with two fields:component identifies the trust boundary that produced the record. from
identifies the Kernel subsystem. Common values include:
httpfor HTTP access records;socketiofor Socket.IO connection and event records;plugin_managerfor plugin discovery and lifecycle records; andconfig,server, andclifor configuration, server, and command-line activity.
Debug source locations
WhenLevel = "debug", the logger automatically adds source with the
application call site. This is useful for locating the code that emitted a
diagnostic record, but it increases the size of every record and usually
increases log volume as well.
Do not confuse source with from:
sourceis the debug-only logger call location; andfromis the stable Kernel subsystem or plugin identity.
info, warn, and error levels, the call-site source field is omitted.
HTTP access logs
The Kernel emits one access record after every HTTP request, including requests handled by Kernel routes, plugin HTTP handlers, static mounts, and the Socket.IO HTTP endpoint. Each record contains:
The access record uses
component=kernel and from=http. Its log level is
selected from the final status:
4xxresponses are logged atWARN;5xxresponses are logged atERROR; and- all other responses are logged at
INFO.
Socket.IO logs
Socket.IO records usecomponent=kernel and from=socketio. The Kernel logs:
- successful connections and disconnections at
INFO, including the namespace and socket ID; - unavailable namespaces and rejected connections at
WARN; - malformed or undeclared events at
DEBUG; - successful event handling at
DEBUG, including the namespace, event, plugin, andduration_ms; and - plugin handler, payload-processing, or emit failures at
ERRORwhen the Kernel cannot complete the operation.
Choosing a level
Useinfo for normal operation. It includes HTTP access records, plugin
lifecycle records, and Socket.IO connection state without logging successful
Socket.IO events.
Use warn when you need to investigate rejected requests, unavailable
namespaces, or other recoverable conditions. Use error when investigating
failed requests or operations.
Use debug temporarily when diagnosing route selection, ignored Socket.IO
events, successful event handling, or the exact call site of a log record.
Return to info after diagnosis to reduce volume and avoid collecting more
diagnostic detail than necessary.