File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
RabbitMQ in Depth
this week in the
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
Debugging Best Practices??
error when i run log file
Log4J with System.out.prinltn
how to log errors occurred in backend java engine or servlet
porb. with log4j
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015