Thanks for the solution,

        This is exactly what I was looking for ;)

Flip

-----Original Message-----
From: Jacob Kjome [mailto:[EMAIL PROTECTED]
Sent: Thursday, April 08, 2004 6:54 PM
To: Log4J Users List
Subject: Re: XML Loggers Configuration



How about this?

<logger name="com.mycompany.mypackage">
     <level value="debug"/>
</logger>
<logger name="com.mycompany" additivity="false">
     <level value="off"/>
     <appender-ref ref="thespecificappenderforthislogger"/>
   </logger>
<root>
     <level value="warn"/>
     <appender-ref ref="Console"/>
</root>

That sets up a Console appender logging at the "warn" level for all 
packages but those under "com.mycompany".  "com.mycompany", essentially 
becomes the root logger for all packages inside "com.mycompany" because 
additivity is turned off.  You don't actually have to use the "off" level, 
it could be any other level you want.  Hope that helps.

Jake

At 01:15 PM 4/8/2004 -0400, you wrote:
>Good day,
>
>     I've browsed several examples of log4j.xml config files and couldn't 
> find the answer I was looking for. Is there a way to configure loggers in 
> the xml file so that we can attach specific appenders to them?
>
>something that would look a bit like:
>
>   <logger name=mypackage.mymodule.myclass>
>     <priority value="info"/>
>     <param name="additivityFlag" value="false"/>
>     <appender-ref ref="thespecificappenderforthislogger"/>
>   </logger>
>
>without adding the appender's reference to the root logger. I know it can 
>be done in a .properties file and "in code" but those answer aren't 
>meeting our needs. We would like to somehow, get rid of the logger 
>hierarchy and specify an appender to execute a particular logging task.
>
>Our config file would then have several appenders, some attached to the 
>root logger (such as console) and some others to specific loggers.
>Upon instanciation of the logger such as 
>LogManager.getLogger(mypackage.mymodule.myclass.class.getName()) we would 
>obtain the configured logger and simply call it's log method.
>
>Thanx in advance,
>
>Flip


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to