Bruno, have you tried setting the additivity flag for the MyClass logger to
"false"? Not sure if it meets all your needs, but it would allow you to
attach an appender to the MyClass logger and prevent propagation to ancestor
loggers and their appenders.

Brett

On Sat, Jan 16, 2010 at 3:37 AM, Bruno Melloni
<[email protected]>wrote:

> All examples on how to split logging across two appenders seem to be 'by
> level', and the XML configuration only has one set of <category> definitions
> rather than one set per appender.  I need to split logging by both class and
> level:
>
>
> -          Default log:  Standard logging for the application, including
> log entries for 'MyClass' at INFO level and above.
>
> -          MyClass log:  Entries for MyClass only, at DEBUG level.  It
> would be acceptable if it also contained MyClass higher logging levels.
>
> My need seems to be pretty standard.  Is there a simple way to do this?
>
> The only solution I found (but not tried) seems too complicated to be
> right:
>
>
> -          Setup the category for MyClass at DEBUG level.
>
> -          Create a MyClass appender in log4j.xml.
>
> -          Write a custom Filter that only accepts MyClass log entries of
> DEBUG level.  Add the filter to the MyClass appender.
>
> -          Write a custom Filter that accepts all log entries except
> MyClass DEBUG entries.  Add the filter to the default appender.
>
> -          Since I am using jBoss' logging facility, place these classes
> 'somewhere' that puts them in jBoss' classpath.  Where would that be?
>
> Any guidance would be greatly appreciated.
>

Reply via email to