Hi,

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



Regards,
Oliver

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to