You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Rob Oxspring <ro...@imapmail.org> on 2005/04/05 13:31:45 UTC
Can log levels be configured based on NDC?
We have an application composed of some low level libraries and some
higher level components all combined to create a single tool. As we
wrote ComponentA it was useful to have the lower level libraries logging
lots of debug but now we have confidence in ComponentA we can switch the
libraries to something higher than DEBUG. Now we need to develop
ComponentB and would like to have the libraries logging at DEBUG when
called from COmponentB and INFO (or whatever) when called from
ComponentA. NDCs seemed the way to go but can I configure the levels
based on the current NDC?
An added complication is that some of our libraries use multiple
threads, is can NDC's be copied to other threads so that the logging is
consistent? or are there other forms of context that are more appropriate?
Thanks in advance,
Rob
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: Can log levels be configured based on NDC?
Posted by James Stauffer <st...@gmail.com>.
Just set the componentA logger to info and the componentB logger to debug.
XML example config:
<logger name="com.componentA">
<level value="info"/>
</logger>
<logger name="com.componentB">
<level value="debug"/>
</logger>
<root>
<appender-ref ref="appender"/>
</root>
On Apr 5, 2005 6:31 AM, Rob Oxspring <ro...@imapmail.org> wrote:
> We have an application composed of some low level libraries and some
> higher level components all combined to create a single tool. As we
> wrote ComponentA it was useful to have the lower level libraries logging
> lots of debug but now we have confidence in ComponentA we can switch the
> libraries to something higher than DEBUG. Now we need to develop
> ComponentB and would like to have the libraries logging at DEBUG when
> called from COmponentB and INFO (or whatever) when called from
> ComponentA. NDCs seemed the way to go but can I configure the levels
> based on the current NDC?
>
> An added complication is that some of our libraries use multiple
> threads, is can NDC's be copied to other threads so that the logging is
> consistent? or are there other forms of context that are more appropriate?
>
> Thanks in advance,
>
> Rob
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
--
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org