Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Help with Log4j
Joined: Jan 06, 2005
Jan 12, 2005 11:55:00
How can I pass the error statements to a file and debug statements to the console using log4j?
Joined: Mar 18, 2003
Jan 17, 2005 11:08:00
instantiate 2 loggers:
Logger logErrors = Logger.getLogger(YourClass.class); Logger logDebugs = Logger.getLogger(YourClass.class);
and create appenders for each in log4j.properties:
log4j.logger.yourpackage.yourclass=ERROR, txt_errors ... log4j.logger.yourpackage.yourclass=DEBUG, txt_debugs ...
n.b. txt_debugs will log everything of DEBUG priority and higher (including ERRORs), therefore messages may be duplicated.
BTW - this should probably be in "Other Open Source Projects".
I agree. Here's the link:
subject: Help with Log4j
error when i run log file
Debugging Best Practices??
Log4J with System.out.prinltn
porb. with log4j
how to log errors occurred in backend java engine or servlet
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013