How to colorize Log4j2 output on console in intelliJ?

Use log4j2's stable version 2.9.1 and replace LOGGER initialization with

private static final Logger LOGGER = LogManager.getLogger(Class.class.getName());

Additional documentation about highlighting your console appender: https://logging.apache.org/log4j/2.x/manual/layouts.html


For IntelliJ I can highly recommend the Grep Console Plugin.

It can parse console output for logs and much more without changing the source code.

enter image description here


It seems like some default is broken in 2.10.0. By adding disableAnsi options, I could get the colors back with the last release.

<PatternLayout pattern="%highlight{...}" disableAnsi="false"/>

In the docs, it is said to default to false but it doesn't seem the case.

Tags:

Colors

Log4J2