Skip to content

Set up log levels in logLevels.yaml

This page explains how to configure log levels for each KXS logging facility in logLevels.yaml using the severity hierarchy.

In this configuration object, you set the log level for each logging facility (LOAD, SAPI, SDL, MDL, VEE, VAL, PEN, etc.). Each level acts as a threshold for the log messages that are generated for a given process. That is, depending on which log level a process is assigned, it receives all the log messages from that level on down. The hierarchy of log levels, from most to least verbose, is:

  1. Trace
  2. Debug
  3. Info
  4. Error
  5. Warn
  6. Fatal

For example, if you assign the log level info to the RDB facility, any processes involving the RDB facility receive info, error, warn, and fatal log messages.

The following example shows a logLevels.yaml configuration:

logLevels:
  values:
    <default>:
      level: trace
      description: Default log level
    <any>:
      description: Any facility not explicitly specified

    COMM:
      level: debug
      description: Communications interface

    MSG:
      level: debug
      description: Messaging system

    GW:
      level: debug
      description: Service gateway

    EMS:
      level: debug
      description: Enterprise messaging interface

The <default> entry applies to any log facility explicitly listed in an overlay. The <any> entry applies to any log facility not listed but referenced by KX. In the absence of an <any> entry in the YAML configuration, the default log level is info.

Each entry in logLevels.yaml has the following properties:

Column Name Definition Example
name Name of the facility LOG
level Its assigned log level info
description Description of the facility

If you run the q process from the command line, you can use the .log.push[facility;level] or .log.pushAll command to achieve the same function.

2023.02.09 20:17:35.014 TRACE [kxsHDB_B3] EMS Ignoring message from irrelevant topic, stream=emsint topic=_checkpoint.feed1 pos=5761383
2023.02.09 20:17:35.014 TRACE [kxsHDB_B3] EMS Ignoring message from irrelevant topic, stream=emsint topic=_checkpoint.feed2 pos=5761514
.log.push[`EMS;`info]
q)
q).log.push[`EMS;`trace]
q)2023.02.09 20:18:05.014 TRACE [kxsHDB_B3] EMS Ignoring message from irrelevant topic, stream=emsint topic=_checkpoint.feed2 pos=5762955
2023.02.09 20:18:05.014 TRACE [kxsHDB_B3] EMS Ignoring message from irrelevant topic, stream=emsint topic=_checkpoint.feed1 pos=5763086
2023.02.09 20:18:10.014 TRACE [kxsHDB_B3] EMS Ignoring message from irrelevant topic, stream=emsint topic=_checkpoint.feed2 pos=5763217
2023.02.09 20:18:10.014 TRACE [kxsHDB_B3] EMS Ignoring message from irrelevant topic, stream=emsint topic=_checkpoint.feed1 pos=5763348

Next steps