Skip to content

Logging

Nicolas Pepin-Perreault edited this page Sep 23, 2021 · 2 revisions

Logging

Zeebe uses SLF4J everywhere for logging, with the gateway and the broker using Log4J2 as the default implementation. It's recommended you at least familiarize yourself with SLF4J by reading the getting started and the FAQ.

Formatting

When logging something, use the built-in formatting provided by SLF4J (as opposed to, for example, String.format). Not only is this less verbose, but it avoids performing unnecessary string interpolation when logging at a lower level than configured.

Levels

By convention, we use the log levels as follows:

  • TRACE: information which is helpful only if you want to trace the execution of a particular component. In general TRACE logging should be using granular loggers, i.e. loggers tied to very specific components, such that we can enable them for those to avoid creating too much noise.
  • DEBUG: information which can provide helpful context when debugging. To help you decide whether it is TRACE or DEBUG, or INFO, ask yourself: is this useful for a user, or just for a developer trying to diagnose what happened? It's also perfectly acceptable to add DEBUG messages right after an INFO one to provide more context.
  • INFO: information about the system which is useful for the user (note: in the case of the broker, user here is the SRE deploying it), e.g. leader changes, a new node added to or removed from the membership, etc.
  • WARN: expected errors (e.g. connection time outs, the remote node is unavailable, etc.) which may indicate that parts of the system are not working, and would require attention if they persist, but may resolve by themselves
  • ERROR: errors which require a person to look into them, e.g. log corruption, inconsistent log, anything which could shut down a partition, etc.