Get colors in TomEE console

Adding some color to a console output is always nice. Here how to do with TomEE.

Under Unix OS it is not so complicated to add some colors to TomEE (it works for Tomcat too).

First create a small java project, add to the classpath jlibs-core. With maven you’ll probably add something like:


      <name>JLibs Repository</name>

Then create a small class to force the formatter of the handler:

package org.apache.openejb.log.juli;

import java.util.logging.ConsoleHandler;
import jlibs.core.util.logging.AnsiFormatter;

public class ColorConsoleHandler extends ConsoleHandler {
    public ColorConsoleHandler() {
        setFormatter(new AnsiFormatter());

Then edit $CATALINA_BASE/conf/ to replace java.util.logging.ConsoleHandler by our brand new Handler:

handlers =,,,, org.apache.openejb.log.juli.ColorConsoleHandler
.handlers =, org.apache.openejb.log.juli.ColorConsoleHandler

And finally edit $CATALINA_HOME/bin/ to add jlibs-core and our jar to the JVM classpath.

# Add tomcat-juli.jar to classpath
# tomcat-juli.jar can be over-ridden per instance
if [ -r "$CATALINA_BASE/bin/tomcat-juli.jar" ] ; then

Then simply restart using:


And your logs should be in color.

Note jlibs ansi colors are configurable through a file (see jlibs).

Easy no?

Note: for a real usage i guess you’ll update the formatter to get a format closer to SimpleFormatter.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s