There is no standard way for color coding messages.
For some terminals this is done with escape codes, which I don’t
believe that e.g. Eclipse supports´in its Console window, and I do not expect
that e.g. Chainsaw og Lilith support these.
From: logback-user-bounces@qos.ch
[mailto:logback-user-bounces@qos.ch] On Behalf Of Vaibhav Malhotra
Sent: 28. oktober 2010 13:57
To: logback-user@qos.ch
Subject: [logback-user] Coloring log messages
Hi all
I am quire fascinated about the powers and ease logback
gives to its users. I am experimenting with various options it offers
like appenders, encoders etc.Recently I though if we could color code the log
messages for various logging levels. For example, red for Error, Green for
Trace etc. I have these options with me but none seemed to work as desired:
- Extending <code> ClassicConverter </code>
& overriding <code> convert(ILoggingEvent) </code> as given in
the documentation chapter 6 for Creating a custom conversion specifier. This
way, I could color the level using <code> event.getLevel() </code>
but could not color the entire log statement as per my wish.
- On the page http://logback.qos.ch/demo.html it
is written that "You can color log statements with markers. Markers
are part of the SLF4J API." But I could not find any example for that.
- I tried extending <code> RollingFileAppender
</code> and in the <code> subAppend </code> I tried to
access <code>quirtWriter qs </code> as one could do
in earlier versions, but
now <code> qs </code> is not visible.
Please guide for the appropriate way of doing it as
well as provide some directions / examples.
Thanks & Regards
Vaibhav Malhotra