On 2009-06-15 06:16, deepak singh wrote:
On Mon, Jun 15, 2009 at 5:43 PM, Assaf Lavie <[email protected]> wrote:
On Mon, Jun 15, 2009 at 3:11 PM, deepak singh <[email protected]>wrote:
I am using NDC (*nested diagnostic contexts*) for appending the text
from a specific thread.
But the issue is I am not able to get the "Thread specific Info" message
in any of the messages I am printing in that thread.
>>>
>> What format pattern are you using?
>>
> log4cxx::LayoutPtr layoutPtr(new log4cxx::PatternLayout("%c-%p (%d{dd MMM
> yyyy HH:mm:ss}) [%-5t] %m%n"));
Your pattern layout does not include the conversion character to indicate where
you want your NDC stack to be inserted:
x - Used to output the NDC (nested diagnostic context) associated with the
thread that generated the logging event. (From the PatternLayout documentation.)
"%c-%p (%d{dd MMM yyyy HH:mm:ss}) [%-5t] %x %m%n"
That change should fix your output issue and then you can start playing more
with placement (or use at all) of the NDC::push/NDC::pop methods and see where
they work best for you. I prefer to use the constructor to set the value and let
stack scope take care of the pop.
--
Jacob Anawalt
Gecko Software, Inc.
[email protected]
435-752-8026