Re: default value for missing key in mdc

2013-10-09 Thread Woonsan Ko
Hi Ralph, I have something related to this improvement idea. I have thought it might be a bit more useful and flexible to allow default value in the variable expression itself. For example, ${var1:-defvalue1}, ${ctx:request_id:-defvalue2}, etc. This generic feature has been included in

Re: default value for missing key in mdc

2013-10-09 Thread Ralph Goers
Please remember that mine is just one opinion, but I am fine with that. I guess if no default value is provided this way then it can still fall back to looking in the properties map. Ralph On Oct 9, 2013, at 12:53 PM, Woonsan Ko woon_...@yahoo.com wrote: Hi Ralph, I have something

Re: default value for missing key in mdc

2013-10-09 Thread Jonathan Willis
http://stackoverflow.com/questions/19277445/how-to-use-map-lookups-using-log4j2 On Wed, Oct 9, 2013 at 2:18 PM, Ralph Goers ralph.go...@dslextreme.comwrote: Please remember that mine is just one opinion, but I am fine with that. I guess if no default value is provided this way then it can

Re: default value for missing key in mdc

2013-10-09 Thread Ralph Goers
Can you provide your lookup source? On Oct 9, 2013, at 1:22 PM, Jonathan Willis quicksilver...@gmail.com wrote: http://stackoverflow.com/questions/19277445/how-to-use-map-lookups-using-log4j2 On Wed, Oct 9, 2013 at 2:18 PM, Ralph Goers ralph.go...@dslextreme.comwrote: Please remember

Re: default value for missing key in mdc

2013-10-09 Thread Jonathan Willis
[image: Inline image 1] [image: Inline image 2] On Wed, Oct 9, 2013 at 3:05 PM, Ralph Goers ralph.go...@dslextreme.comwrote: Can you provide your lookup source? On Oct 9, 2013, at 1:22 PM, Jonathan Willis quicksilver...@gmail.com wrote:

Re: default value for missing key in mdc

2013-10-09 Thread Remko Popma
Jonathan, Would you mind raising a JIRA ticket for the issue you're reporting? That makes it easier for us to track and easier for you to attach config files or image files. (The mailing list software may not like image file attachments...) Best regards, Remko Sent from my iPhone On

Re: default value for missing key in mdc

2013-10-09 Thread Jonathan Willis
How do you create a jira ticket? I looked for where i could but i didnt see anywhere that said add issue On Oct 9, 2013 4:47 PM, Remko Popma remko.po...@gmail.com wrote: Jonathan, Would you mind raising a JIRA ticket for the issue you're reporting? That makes it easier for us to track and

Re: default value for missing key in mdc

2013-10-09 Thread Remko Popma
Oh. Sorry. Here you are: http://logging.apache.org/log4j/2.x/issue-tracking.html Sent from my iPhone On 2013/10/10, at 8:25, Jonathan Willis quicksilver...@gmail.com wrote: How do you create a jira ticket? I looked for where i could but i didnt see anywhere that said add issue On Oct 9,

Re: default value for missing key in mdc

2013-10-09 Thread Jonathan Willis
i am able to view the jira page, and i have been there before, but i don't see how to add an issue. Do i need credentials to log in? On Wed, Oct 9, 2013 at 5:43 PM, Remko Popma remko.po...@gmail.com wrote: Oh. Sorry. Here you are: http://logging.apache.org/log4j/2.x/issue-tracking.html Sent

Re: default value for missing key in mdc

2013-10-09 Thread Remko Popma
Yes. Anyone can read existing issues, but to add or comment you need to create an account. Best regards, Remko On Thursday, October 10, 2013, Jonathan Willis wrote: i am able to view the jira page, and i have been there before, but i don't see how to add an issue. Do i need credentials to log

Re: default value for missing key in mdc

2013-10-01 Thread Oliver Flege
$${mdc:request_id} in a pattern should cause the request_id to be evaluated on every event. thanks a lot, $${ctx:request_id} seems to do the trick however, the computation of the default value is quite complex as it always involves a variable substitution, and I cannot use conversion

Re: default value for missing key in mdc

2013-10-01 Thread Ralph Goers
Patches are always welcome! Ralph On Oct 1, 2013, at 1:13 AM, Oliver Flege ofl...@vwd.com wrote: $${mdc:request_id} in a pattern should cause the request_id to be evaluated on every event. thanks a lot, $${ctx:request_id} seems to do the trick however, the computation of the default

default value for missing key in mdc

2013-09-30 Thread Oliver Flege
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).

Re: default value for missing key in mdc

2013-09-30 Thread Ralph Goers
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 ofl...@vwd.com wrote:

Re: default value for missing key in mdc

2013-09-30 Thread Oliver Flege
ok, this works for ${...} expressions in the configuration, but I don't see how it would apply to pattern evaluation. To simplify and rephrase my original question: Given a pattern layout with a pattern like: %X{REQUEST_ID} is it possible to define a default value that will be printed if the

Re: default value for missing key in mdc

2013-09-30 Thread Ralph Goers
$${mdc:request_id} in a pattern should cause the request_id to be evaluated on every event. Ralph On Sep 30, 2013, at 8:04 AM, Oliver Flege ofl...@vwd.com wrote: ok, this works for ${...} expressions in the configuration, but I don't see how it would apply to pattern evaluation. To