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: How can I set the output color of log4j?
Date Mon, 17 Mar 2008 09:47:42 GMT
Since you do not specify which displaying application shall show colors I can give you advice
how to achieve it within the eclipse console display:

Configure two separate appenders. One for the levels WARN and higher and one for the levels
INFO and lower. Assign them to the std.err and std.out. Here a config example:

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

    <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"/>
        </layout>
        <filter class="org.apache.log4j.varia.LevelRangeFilter">
            <param name="LevelMin" value="debug"/>
            <param name="LevelMax" value="info"/>
            <param name="AcceptOnMatch" value="false"/>
        </filter>
    </appender>

Eclipse console will display WARN and higher in red, INFO and lower in black color.

Heri


> -----Original Message-----
> From: youhaodeyi [mailto:youhaodeyi@gmail.com]
> Sent: Saturday, March 15, 2008 9:50 AM
> To: log4j-user@logging.apache.org
> Subject: How can I set the output color of log4j?
> 
> 
> 
> I want to set different colors for different priority log. 
> How can I do that?
> -- 
> View this message in context: 
> http://www.nabble.com/How-can-I-set-the-output-color-of-log4j-
> -tp16065799p16065799.html
> Sent from the Log4j - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 

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


Mime
View raw message