Yes, this is what I am looking for.  Thanks much.

However, in your example, the logger should be more like this:

<logger name="org.myorganization.mypackage.mysubpackage" additivity="false">
         <level value="debug"/>
         <appender-ref ref="A1"/>
</logger>

where the level tag precedes the appender-ref tag, and the appender-ref ref attribute 
is the name of the appender.

--Mark


-----Original Message-----
From: Jacob Kjome [mailto:hoju@;visi.com]
Sent: Tuesday, November 05, 2002 12:51 PM
To: Log4J Users List
Subject: Re: Can groups of classes be assigned independent appenders?



It all depends on how you name your loggers.  The common way to name your 
loggers is, of course,

private static final Logger logger = Logger.getLogger(MyClass.class.getName());

this would end up being called something like:

org.myorganization.mypackage.mysubpackage.MyClass

to have every class in "mysubpackage" have logging enabled for the level 
"debug" I'd do:

<appender name="A2" class="org.apache.log4j.FileAppender">
     <param name="File" value="c:\main.log" />
     <param name="Append" value="false" />
     <layout class="org.apache.log4j.PatternLayout">
         <param name="ConversionPattern" value="%-4r [%t] %-5p %c %x - %m%n"/>
     </layout>
</appender>

<logger name="org.myorganization.mypackage.mysubpackage" additivity="false">
         <appender-ref ref="MyFileAppender"/>
         <level value="debug"/>
</logger>

Notice the additivity="false".  If I didn't have that, I'd also be logging 
what the <root> logger or any other logger this logger might be inheriting 
from had defined to log.

Is that what you were looking for?

Jake


At 11:32 AM 11/5/2002 -0800, you wrote:
>Can a class or group of classes be assigned to appenders independently 
>from other classes?
>
>I'd like to implement a message driven bean in Jboss and I'd like the 
>output of that bean to go to a log file other then the standard 
>application server log.
>
>Thanks,
>Mark
>
>--
>To unsubscribe, e-mail:   <mailto:log4j-user-unsubscribe@;jakarta.apache.org>
>For additional commands, e-mail: <mailto:log4j-user-help@;jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:log4j-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:log4j-user-help@;jakarta.apache.org>

Reply via email to