A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
EJB 3 in Action
this week in the
EJB and other Java EE Technologies
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".
With a little knowledge, a
cast iron skillet
is non-stick and lasts a lifetime.
subject: Help with Log4j
porb. with log4j
Log4J with System.out.prinltn
Debugging Best Practices??
how to log errors occurred in backend java engine or servlet
error when i run log file
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014