Mark -

I had tried it, but I must have missed something because the second before
your reply arrived I tried again and had it working ;)  Doh!

thanks!

-----Original Message-----
From: Mark Womack [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 06, 2002 10:59 AM
To: 'Log4J Users List'
Subject: RE: package level Logger configuration?


Scott,

Have you tried it?  Yes, it should work as you expect, and I think your
syntax is fine, but then I don't use the PropertyConfigurator.  In XML it
would look like:

    <logger name="<package_name>">
        <level value="debug"/>
          <appender-ref name="A1"/>
    </logger>
    <logger name="<another_package_name>">
        <level value="fatal"/>
          <appender-ref name="A1"/>
    </logger>

or something like that.  I use this quite often to set the level for all the
classes within a given package and then I set the level for individual
classes within that package as needed.  So, adding another configuration:

    <logger name="<another_package_name>.FooClass1">
        <level value="debug"/>
    </logger>

hope it helps,
-Mark


> -----Original Message-----
> From: Klein, Scott @ TW [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, June 06, 2002 10:13 AM
> To: Log4J-User (E-mail)
> Subject: package level Logger configuration?
> 
> 
> I must not be looking in the right place, but from reading 
> the documentation
> it appears that the following is possible:
> 
> log4j.logger.<package_name>=DEBUG, A1
> log4j.logger.<another_package_name>=FATAL, A1
> (assume <package_name> and <another_package_name> do not overlap for
> simplicity sake)
> 
> where, all of the classes under <package_name> will use the first
> configuration and the classes under <another_package_name> 
> will use the
> second - rather than having to list each class separately 
> (and I don't want
> them to inheirit the root loggers config - i.e. additivity is false)
> 
> in other words, if i have a class:
> 
> package <package_name>;
> 
> public class AClass {
>     Logger logger = Logger.getLogger( this.getClass() );
> }
> 
> then it would look get a logger with the first configuration.
> 
> So, my question is - (1) is that true - and possible?,  (2) 
> what is the
> proper syntax in the configuration file?
> 
> Also, it must be in a configuration file ... I know how much 
> everyone likes
> to do it programatically, but I cannot.
> 
> 
> thanks
> scott
> 
> --
> To unsubscribe, e-mail:   
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

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

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

Reply via email to