On Aug 17, 2005, at 4:24 PM, Yixing Ma wrote:
Hi,
Is there a way to change the color of debug, info, error and warn
in the console?
There was a rejected bug (http://issues.apache.org/bugzilla/
show_bug.cgi?id=19920) that contained one persons approach to the
issue (with a patch which you could use for yourself).
A ConsoleAppender might not be writing to a console device, it may be
redirected to a file or another application where the escape codes to
add color might not be desired. So it isn't desirable to
unconditionally add color without some user configuration. Also,
since log4j console output could be interspersed with other console
output, you'd need to make sure to reset the color after each message.
The layout would likely be the right place to add color. For
example, a colorized TelnetAppender would be equally valid as a
colorized ConsoleAppender and placing it in the layout would allow
both applications to share the supporting code.
I'm guessing the referenced patch only prints the level in color, for
example, WARN in yellow. I don't know if that is what you wanted, or
if you'd like the entire message body in color.
I have on my long wish list to add a localizing layout that could
make pattern substitutions in the logging process (http://
issues.apache.org/bugzilla/show_bug.cgi?id=32810). If such a thing
existed, you could "translate" the standard english text into text
wrapped by VT-100 escape codes. This use might make an interesting
use case, if I ever get to that.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]