Klogging handles most log events asynchronously by using Kotlin coroutines. This design takes logging away from the main threads of program execution as soon as possible.
But asynchronous processing delays the sending of log events to sinks, so they may be lost when the program finishes. This can be a problem if the log events occur immediately before a program crashes. Those events may contain valuable information about why the crash happened.
By default, Klogging sends all events with level
WARN and above (
FATAL) directly to
sinks. The minimum level can be configured using the configuration DSL or
in JSON files.
In the DSL:
// Other configuration
The level can also be set using the environment