Logging

The logging module defines a logging setup for the whole IM instance.

We use logback as the default logging provider. If you want to change the provider, you must exclude logback and provide your own implementation.

Appenders

Logback has configured several appenders:

  • STDOUT

  • FILE

  • LOGSTASH

Those appenders deal with logging to different places.

Masking

Each appender has a masking mechanism to prevent confidential information (like passwords, secrets, ...) to be logged in plaintext. For perfomance-wise operations, masking is disabled by default. 

STDOUT/FILE Masking

Masking for the STDOUT/FILE appenders is easy. All you have to do is use the marker MaskingUtils.SENSITIVE when logging a message.

Example with masking disabled:

log.warning("This is a warning. This password=test will be stored in plaintext");

Result:

This is a warning. This password=test will be stored in plaintext


Example with masking enabled:

log.warning(MaskingUtils.SENSITIVE, "This is a good sign. This password=test will be masked.");

Result:

LOGSTASH Masking

Masking for the LOGSTASH appender is divided into two parts:

  • Masking message – Put the marker value MaskingUtils.SENSITIVE_VALUE into the markers value map. Its value is irrelevant as long as it is present.

  • Masking markers – Use the marker net.pricefx.integration.platform.logging.MaskingMarker and masking will be enabled by default.

In a standard situation, you want to mask both pieces of information.

Example with message masking enabled:

Result:

As you can see, only the message is masked.

 

Example with markers masking enabled:

Result:

As you can see, only the markers are masked.

 

Example with markers masking enabled:

Result:

As you can see, only the markers are masked.

 

Example with both message masking and markers masking enabled:

Result:

As you can see, everything is masked.

Altering Appenders Behavior

If you want to change default behavior of logging/appenders, it is recommended to create a logback.xml file with the required configuration. This file will take precendence over the setup in IM.

IntegrationManager version 5.8.0