eclipse console log color coding...

775 views
Skip to first unread message

Jim Hargrave

unread,
Mar 6, 2014, 7:01:20 PM3/6/14
to okapi...@googlegroups.com
http://mihai-nita.net/2013/06/03/eclipse-plugin-ansi-in-console/

Mihai has already mentioned this before. My eyes have gotten blurry
staring at black logs and test results all day. I found this very, very
useful. Wish I wasn't so lazy before :-)

Anyone else using an eclipse plug-in that will color code the console?

I also use this ones which attaches to an external log. You can create
patterns and map those to colors. Very helpful for tomcat logs.

http://logviewer.eclipselabs.org.codespot.com

Jim

Chase Tingley

unread,
Mar 6, 2014, 8:28:14 PM3/6/14
to okapi...@googlegroups.com
Hmm, pretty interesting.  I was just talking about my old ANSI art days in the early 90s with somebody in the office.

Jim, are you actually using jansi to insert color codes into your console output now?




Jim

--
You received this message because you are subscribed to the Google Groups "okapi-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to okapi-devel+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jim Hargrave

unread,
Mar 6, 2014, 8:53:14 PM3/6/14
to okapi...@googlegroups.com
No, I use Mihai's ColorConsoleAppender.

# This file gets read by log4j as part of its default configuration during startup.
# See http://logging.apache.org/log4j/1.2/manual.html for details on where log4j looks
# for its configuration. log4j requires the rootLogger and appender configuration for
# a clean startup.
log4j.rootLogger=INFO, A1

# A1 is set to be a ConsoleAppender.
#log4j.appender.A1=org.apache.log4j.ConsoleAppender
# If you want color output you can comment the line above and comment this one
log4j.appender.A1=net.sf.okapi.log4j.ColorConsoleAppender

# How to get color output in the Windows console
# - Download and run ansicon (http://adoxa.3eeweb.com/ansicon)
# or
# - Rewrite ColorConsoleAppender to use jansi (http://jansi.fusesource.org)

# How to get color output in the Eclipse console
# - Install "ANSI in Eclipse Console" (http://www.mihai-nita.net/eclipse)

# A1 uses PatternLayout.
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=[%t] %-5p: %c %x - %m%n

# You can customize the colors of the ColorConsoleAppender using ANSI escape sequences
# http://en.wikipedia.org/wiki/ANSI_escape_code
log4j.appender.A1.FatalColour=\u001b[1;41;37m
log4j.appender.A1.ErrorColour=\u001b[1;31m
log4j.appender.A1.WarnColour =\u001b[1;33m
log4j.appender.A1.InfoColour =\u001b[0;32m
log4j.appender.A1.DebugColour=\u001b[0;36m
log4j.appender.A1.TraceColour=\u001b[1;30m

# Quiet down some of the logging (example)
# log4j.logger.net.sf.okapi.common.filters.EventBuilder=WARN
log4j.logger.net.sf.okapi.filters.abstractmarkup.AbstractMarkupEventBuilder=WARN
# log4j.logger.net.sf.okapi.filters.html.HtmlFilter=DEBUG
To unsubscribe from this group and stop receiving emails from it, send an email to okapi-devel...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "okapi-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to okapi-devel...@googlegroups.com.

Chase Tingley

unread,
Mar 6, 2014, 9:53:39 PM3/6/14
to okapi...@googlegroups.com
Very nice stuff, Mihai!

Mihai Nita

unread,
Mar 7, 2014, 5:58:55 AM3/7/14
to Group: okapi-devel
I am glad you like it :-)

Here is a link on how to use the color appender in okapi (at the very end):
   http://code.google.com/p/okapi/wiki/OkapiLogging

And meantime maven moved to slf4j, so you can swap out the default logger and use log4j and colors:
   http://mihai-nita.net/2013/09/12/color-logging-with-maven/

Apparently hopefully colors are coming back :-)
logback and log4j2 support colors "out of the box", no need for custom appenders
And I have seen several requests for color logging on maven forums.
Just wonder why took so long for the "new kids" to re-discover color in console...

Mihai

Reply all
Reply to author
Forward
0 new messages