Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

print text with colors with log4perl

Status
Not open for further replies.

donny750

Programmer
Jul 13, 2006
145
0
0
FR
hello,

It is possible, when using log4perl :
$log->info("System checking");

To print the text(System checking) in red or green(or another colors) ?

Thanks.
 
It might have a log appender that suports coloured logging to a console, but not to a file.

Steve

[small]"Every program can be reduced by one instruction, and every program has at least one bug. Therefore, any program can be reduced to one instruction which doesn't work." (Object::perlDesignPatterns)[/small]
 
ok i must use this Log::Log4perl::Appender::ScreenColoredLevels ?
but where ???
 
You're on your own with this one, donny. In your previous thread, you asked about how to log stuff in perl. I pointed you at log4perl. I never said I'd used it...[wink]

There seemed to be plenty of documentation and samples, however. Have you tried looking at any of them?

Steve

[small]"Every program can be reduced by one instruction, and every program has at least one bug. Therefore, any program can be reduced to one instruction which doesn't work." (Object::perlDesignPatterns)[/small]
 
ok
I use actually log4perl in my script
 
i've find
i make this in my xml file

Code:
<appender name="CONSOLE" class="Log::Log4perl::Appender::ScreenColoredLevels">
 
Does it work OK?

Steve

[small]"Every program can be reduced by one instruction, and every program has at least one bug. Therefore, any program can be reduced to one instruction which doesn't work." (Object::perlDesignPatterns)[/small]
 
yes, it work
the text color change according to the log level(info -> green, warn -> blue....)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top