logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bender Heri <hben...@ergonomics.ch>
Subject RE: Help understanding Log4j basics
Date Thu, 25 Nov 2010 14:26:02 GMT
> I've previously searched the manual and I understand the hierarchy of:
> However, I'm interested in in learning if there is a way to print ONLY
> one level rather than the target level and all levels above it. Unless
> I've missed it, the manual does not explain if this is possible (or
> how to do it).

In order to print a particular level only you can use LevelFilters which you can configure
in xml configuration. E.g.

    <appender name="CONSOLE.OUT" class="org.apache.log4j.ConsoleAppender">
        <param name="target" value="System.out"/>
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%d{HH:mm:ss.SSS} (%6r) %-5p [%-7t] %F:%L
%x - %m%n"/>
        <filter class="org.apache.log4j.varia.LevelRangeFilter">
            <param name="LevelMin" value="trace"/>
            <param name="LevelMax" value="info"/>
            <param name="AcceptOnMatch" value="false"/>

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

View raw message