Thursday, 22 August 2013

Logback coloring based on class/package

Logback coloring based on class/package

I've started reading about Logback (currently using log4j and thinking
about switching). I'm interested in the possibilities to color the logged
messages. Browsing through previous questions, I've only seen mentions of
coloring different parts of the message (conversion patterns) or coloring
exceptions.
What I'm interested in, however, is whether logback can color my messages
based on their package or class.
For example, let's say my application is composed of two main components-
a producer and a consumer, and they both are composed of a large
dependency tree. Can I have any message which is logged through the
consumer colored red, and any message which is logged through the producer
colored blue?
Please notice that I don't want this to interfere with log levels (that
is, I still want to have the option to set components to debug/error etc,
ideally without having to mind the coloring.
Thanks!

No comments:

Post a Comment