Re: Display text when thread context is empty

2017-03-22 Thread Matt Sicker
I believe he's referencing this: https://logging.apache.org/log4j/2.x/manual/extending.html#Custom_ContextDataInjector On 22 March 2017 at 14:48, Christian wrote: > Thanks Matt and Ralph! > > I also thought if it is possible to use the %replace pattern for this > purpose. I think I will give th

Re: Display text when thread context is empty

2017-03-22 Thread Christian
Thanks Matt and Ralph! I also thought if it is possible to use the %replace pattern for this purpose. I think I will give this a try. @Ralph: What do you mean with "Data Injection stuff"? Do you have any link a documentation with information about this? Best regards, Christian Am 22.03

Re: Display text when thread context is empty

2017-03-22 Thread Matt Sicker
There's the %notEmpty{} pattern which only outputs its pattern if all its variables are not empty. If you want a default value, then perhaps combine that with %replace{%notEmpty{%X{userNumber}}}{^$}{fallback value} or something similar. You shouldn't need the %notEmpty{} bit if you don't add anythi

Re: Display text when thread context is empty

2017-03-22 Thread Ralph Goers
If userNumber does not exist in the ThreadContext then nothing will be included in the display. I am not aware that we have implemented any way to specify a default value for this, but with the Data Injection stuff that was added a few releases ago it might be possible. Ralph > On Mar 22, 201