[logback-user] Coloring log messages

Vaibhav Malhotra vaibhavm.842 at gmail.com
Thu Oct 28 13:56:35 CEST 2010


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://qos.ch/pipermail/logback-user/attachments/20101028/96685e65/attachment.html>


More information about the Logback-user mailing list