[logback-user] ANSI coloring?

Adam Gordon adam.n.gordon at gmail.com
Thu Jun 7 17:22:07 CEST 2012


Ack.  Sorry.  That wasn't clear.  Who controls [ERROR] being red, for example?  That was the question I was trying to ask.  If the highlight.xml file is what controls this, along with the ability to set the actual terminal codes (our terminal codes add bold, e.g., to some of the log levels), I believe we can use this.

--adam

http://gordonizer.com


On Jun 7, 2012, at 8:49 AM, ceki wrote:

> Hi Adam,
> 
> Color control is done within the pattern by color converters which are just composite converters, i.e. converters containing other conveters. Here is a sample "pattern" property:
> 
>  <pattern>%highlight(%-5level) %cyan(%logger) - %msg%n</pattern>
> 
> Note the %highlight and %cyan composite conversion specifiers which contain other conversion specifiers (you can have as many as you want).
> 
> For instance, the following is legal:
> 
>  <pattern>%highlight(%-5level %logger - %msg)%n</pattern>
> 
> The %highlight specifier is implemented by HighlightingCompositeConverter [1] all in about 10 lines of code.
> 
> [1] http://goo.gl/YJA8T
> -- 
> Ceki
> http://twitter.com/#!/ceki
> 
> 
> 
> On 07.06.2012 15:53, Adam Gordon wrote:
>> I'm on my mobile at the moment so I can't look at highlight.xml.  I
>> would assume that this file controls the color to log level mapping?
>> 
>> I wrote a custom encoder a while ago that essentially does this,
>> however, am happy to upgrade to the latest logback and see if it will
>> work for us.  if so, I'm happy to use it and have one less dependency.
>> 
>> will check later this morning.
>> 
>> --adam
>> 
>> On Jun 7, 2012, at 2:49, ceki<ceki at qos.ch>  wrote:
>> 
>>> 
>>> Hello all,
>>> 
>>> Has anyone had a chance to try ANSI coloring [1] as introduced in
>>> logback 1.0.5? It's a seemingly cool feature but I am curious whether
>>> it's actually useful.
>>> 
>>> [1] http://logback.qos.ch/manual/layouts.html#coloring
>>> --
>>> Ceki
>>> http://twitter.com/#!/ceki
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://mailman.qos.ch/mailman/listinfo/logback-user

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20120607/c4a943f1/attachment.html>


More information about the Logback-user mailing list