In my project I use Log4j 2.17.1. I would like to format the output so that the class names have different colors.
public class MyClass {
Logger LOGGER = LogManager.getLogger(MyClass.class.getSimpleName());
//...
LOGGER.debug("Some Information");
}
public class MySecondClass {
Logger LOGGER = LogManager.getLogger(MySecondClass.class.getSimpleName());
//...
LOGGER.debug("Another Output");
}
In my example, I want the two classes to appear in different (perhaps random) colors (instead of yellow as in the example).
My current pattern layout:
%highlight{${LOG_LEVEL_PATTERN:-%5p}}{FATAL=red blink, ERROR=red, WARN=yellow bold, INFO=green, DEBUG=green bold, TRACE=blue} : %style{%logger{36}:}{blue} %msg%n
Is this possible with Log4j?