Yes, it supports default values. Specify them as properties at the beginning of
your configuration. Then when you specify something like ${sys:foo} if foo is
not defined as a system property the default value will be used,
Ralph
> On Sep 30, 2013, at 3:30 AM, Oliver Flege <[email protected]> wrote:
>
> 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]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]