Skip to main content Skip to complementary content

Logging System configuration

Configuration file

The configuration of the logging system uses a standard Log4j configuration file at the following location: <RuntimeContainerPath>/etc/org.ops4j.pax.logging.cfg.

You can edit this file at runtime and any change will be reloaded and be effective immediately.

Configuring the appenders

The default logging configuration defines the following appenders:

  • the console appender is disabled by default. If you plan to run Karaf in server mode only (i.e. with the locale console disabled), you can turn on this appender on by adding it to the list of configured appenders using the log4j2.rootLogger.appenderRef property.

  • the out appender is the one enabled by default. It logs events to a number of rotating log files of a fixed size. You can easily change the parameters to control the number of files using appender.rolling.strategy.max and their size appender.rolling.policies.size.size.

Changing the log levels

The default logging configuration sets the logging levels so that the log file will provide enough information to monitor the behavior of the runtime and provide clues about what caused a problem. However, the default configuration will not provide enough information to debug most problems. The most useful logger to change when trying to debug an issue with Karaf is the root logger. You will want to set its logging level to DEBUG in the org.ops4j.pax.logging.cfg file.

log4j2.rootLogger.level=DEBUG
            ...

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!