You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Mihai Nita <mi...@gmail.com> on 2012/12/03 12:40:24 UTC

Color logging and the 3.1 release

Hello all,

Sorry, I am a total outsider, and I am not quite sure it is polite to
stumble like this in your discussion.
But I have seen that the topic of colored output is pretty hot, mentioned
quite a bit in the last few days,
and (maybe) delaying the release.

So I come with my 2 cents, maybe I can help:
if this is the only show stopper, please release asap!
:-)

You now use slf4j, so there is a lot of flexibility on how to do things.
For instance adding colors is a 5 minute process, here it is:

Get the following 4 libraries:
slf4j-log4j12-1.7.2.jar, log4j-1.2.17.jar color-loggers-1.0.2.jar,
jansi-1.9.jar

========================
log4j-1.2.17.jar
    from http://logging.apache.org/log4j/1.2/download.html
    or
http://search.maven.org/remotecontent?filepath=log4j/log4j/1.2.17/log4j-1.2.17.jar

slf4j-log4j12-1.7.2.jar
    from http://slf4j.org/download.html
    or
http://search.maven.org/remotecontent?filepath=org/slf4j/slf4j-log4j12/1.7.2/slf4j-log4j12-1.7.2.jar

color-loggers-1.0.2.jar
    from https://github.com/mihnita/java-color-loggers/downloads
    or
https://github.com/downloads/mihnita/java-color-loggers/color-loggers-1.0.2.jar

jansi-1.9.jar
    from http://jansi.fusesource.org/download.html
    or
http://repo1.maven.org/maven2/org/fusesource/jansi/jansi/1.9/jansi-1.9.jar
========================

Create a minimal log4j.properties containing this:
========================
log4j.rootLogger=INFO, A1

log4j.appender.A1=com.colorlog.log4j.JansiColorConsoleAppender

log4j.appender.A1.layout=org.apache.log4j.EnhancedPatternLayout
log4j.appender.A1.layout.ConversionPattern=[%5p] %m%n
========================
and put it in a .jar file (let's say log4j.properties.jar)

Or, if you trust me, you get the complete package from
    http://www.mihai-nita.net/tmp/ColorMaven-fullPack.zip
Or just the log4j.properties, more complete, with comments and all
    http://www.mihai-nita.net/tmp/log4j.properties

Now, go to a fresh build of maven, and in the lib folder delete
slf4j-simple-1.7.2.jar and dump the 5 jars above
(4 libraries + log4j.properties.jar)

Voila, colors!

There are also easy ways to get the colors in Eclipse, but let's take it
one at the time :-)
(http://www.mihai-nita.net/eclipse/ or
https://github.com/mihnita/ansi-econsole)

==========

Please let me know if there is anything I can help with
(publish color-loggers-1.0.2.jar to a maven repository, change groupId,
clarify license, whatever)

Thank you very much,
Mihai

Re: Color logging and the 3.1 release

Posted by Mihai Nita <mi...@gmail.com>.
Sorry, two more things:

1. I am not a member of the dev@maven.apache.org list, so if you answer I
will not see the thread
until it makes it in the public archive
And it might also mean that it's possible that my email address gets public
in the list,
or that you don't get these emails at all :-)

2. The current color logger library supports log4j and the jdk logging,
but I have something ready for logback, will make it soon in a public 1.0.3
version
Just in case you have a strong preference for logback over log4j (the old
log4j, 1.2, not the 2.x one)

Thank you very much,
Mihai