[logback-user] ANSI coloring?
ceki
ceki at qos.ch
Thu Jun 7 16:49:34 CEST 2012
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
More information about the Logback-user
mailing list