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 Guillermo Federico <gf...@gmail.com> on 2006/05/04 20:21:58 UTC

Logger level configuration based on simple pattern

In my configuration file I want to specify a specific logging level to all
loggers whose name matches a simple pattern (i.e. *Test ).  Could someone
point me in the right direction?
This seems to be very straightforward, but I have not been able to find any
relevant documentation.
--
View this message in context: http://www.nabble.com/Logger-level-configuration-based-on-simple-pattern-t1558994.html#a4234709
Sent from the Log4j - Users forum at Nabble.com.

Re: Logger level configuration based on simple pattern

Posted by Guillermo Federico <gf...@gmail.com>.
That will definitely work, and keeps things simple.  Thank you.
--
View this message in context: http://www.nabble.com/Logger-level-configuration-based-on-simple-pattern-t1558994.html#a4235429
Sent from the Log4j - Users forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Logger level configuration based on simple pattern

Posted by Jacob Kjome <ho...@visi.com>.
Instead of matching on on the class having "Test" in its name (which might be
able to be done via a Filter on an appender), I would suggest naming your unit
test loggers in a different way than you other loggers.  for instance...

Logger logger = Logger.getLogger("test." + MyClassTest.class);

Then you can say...

<logger name="test" additivity="false">
   <!-- this is, effectively, the root logger for any unit test class -->
   <level value="debug"/>
   <appender-ref ref="JUnitAppender"/>
</logger>

Now you've got a hierarchy of loggers that only apply to test classes and won't
affect other clases at all.

Jake

Quoting Guillermo Federico <gf...@gmail.com>:

>
> In my configuration file I want to specify a specific logging level to all
> loggers whose name matches a simple pattern (i.e. *Test ).  Could someone
> point me in the right direction?
> This seems to be very straightforward, but I have not been able to find any
> relevant documentation.
> --
> View this message in context:
>
http://www.nabble.com/Logger-level-configuration-based-on-simple-pattern-t1558994.html#a4234709
> Sent from the Log4j - Users forum at Nabble.com.
>




---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org