Log colorization for Log4j 1.2.x.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


#Log4j Color

Enable log colorization for Log4j 1.2.x.


Add dependency with your favorite build tool.

Example with Maven:



Use appender fr.jcgay.log4j.color.appender.AnsiConsoleAppender under Windows to enable console ansi colorization (Using Jansi).

Use fr.jcgay.log4j.color.layout.ColorEnhancedPatternLayout to customize your layout with colors.
Current recognize pattern:

  • #highlight() : Colorize text based on current log level (fatal/error in red, warning in yellow, info in bold).

Configuration example log4j.xml

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
	<appender name="console" class="fr.jcgay.log4j.color.appender.AnsiConsoleAppender">
    	<param name="Target" value="System.out"/>
    	<layout class="fr.jcgay.log4j.color.layout.ColorEnhancedPatternLayout">
        	<param name="ConversionPattern" value="#highlight(%-5p) %c{1} - %m%n"/>
    	<priority value ="trace" />
    	<appender-ref ref="console" />