Logging

Logging framework

All the components of the Onegini Mobile Security Platform use the same logging mechanism. The logging framework used by the components is Log4j2.

Configuring logging level

In order to configure logging level for a particular logger, the JAVA_OPTS environment variable should be used. The syntax of setting a logging level is as follows:

JAVA_OPTS="-Dlogging.level.x1=y1 -Dlogging.level.x2=y2"

where:

  • x1, x2 are to be replaced with the logger names
  • y1, y2 are to be replaced by the logging levels

The logger name can be a package name or a fully qualified class name. The logging level is one of the standard Log4j2 logging levels: TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFF.

Example: Setting logging level of all Onegini classes to TRACE:

JAVA_OPTS="-Dlogging.level.com.onegini=TRACE"

Default logging levels

The following list shows the logging levels that are used by default in the Onegini Token Server

logging.level.org.opensaml.saml2.metadata=WARN
logging.level.org.springframework=INFO
logging.level.org.hibernate=WARN
logging.level.com.onegini=WARN
logging.level.com.innovation_district=WARN

When no logging level is configured for a package or class, Log4j2 uses the logging level ERROR.

Setting logging level with docker-compose

Docker compose allows to set environment variables for docker containers. Using this approach the default logging levels can be overridden:

token-server-engine:
  image: snapshot.onegini.com/onegini/token-server-engine:snapshot
  environment:
    - JAVA_OPTS="-Dlogging.level.org.springframework=INFO -Dlogging.level.com.onegini=WARN"