logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Flege <ofl...@vwd.com>
Subject default value for missing key in mdc
Date Mon, 30 Sep 2013 10:30:55 GMT

I am considering to switch from slf4j/logback to log4j2;

in slf4j/logback, I can specify a default value for a missing mdc entry
like this:

<pattern>%d{HH:mm:ss} %X{FOO:--} %c{0} - %m%n</pattern>

which would print "-" if mdc.get("FOO") is null (the ":-" separates
the key and the default value).

Having a defined number of tokens/fields at the beginning of the log message
makes it easier to process it with awk/cut etc.

Does log4j support default values? - I could not find any hint in the documentation


To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org

View raw message