[logback-user] ANSI coloring?

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


> There are some little bugs with this combination, which I had no time
> to investigate. E.g. after an error log message, the whole output
> changes its color saturation.

That sounds suspiciously like someone forgot to reset the terminal code back to normal from red.

Here's what we use in our encoder:

  // Attribute codes:
  // 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
  //
  // Text color codes:
  // 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white

  public static final String COLOR_YELLOW   = "\033[1;33m";
  public static final String COLOR_NEUTRAL  = "\033[0m";
  public static final String COLOR_ALL      = "\033[0m";
  public static final String COLOR_ERROR    = "\033[01;31m";
  public static final String COLOR_WARN     = "\033[01;35m";
  public static final String COLOR_INFO     = "\033[01;34m";
  public static final String COLOR_DEBUG    = "\033[01;36m";
  public static final String COLOR_TRACE    = "\033[0;37m";
  public static final String COLOR_DEFAULT  = "\033[0m";

After every log statement, we have to append COLOR_DEFAULT to change it back to normal (we color our entire log message the same color).

--adam

http://gordonizer.com


On Jun 7, 2012, at 8:50 AM, Lars Fischer wrote:

> Hello Ceki,
> 
> 2012/6/7 ceki <ceki at qos.ch>:
>> 
>> 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.
> 
> I actually started using it for logging during development.
> But my ide (eclipse) does not support taking notice of the ANSI colors.
> 
> So I had to use an additional eclipse extension:
> http://www.mihai-nita.net/eclipse/
> 
> There are some little bugs with this combination, which I had no time
> to investigate. E.g. after an error log message, the whole output
> changes its color saturation.
> 
> But at the moment I find it useful.
> 
> Regards,
> Lars
> _______________________________________________
> 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/07065906/attachment-0001.html>


More information about the Logback-user mailing list