File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Tomcat and the fly likes Log4j Property Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Log4j Property" Watch "Log4j Property" New topic

Log4j Property

Syed Saifuddin
Ranch Hand

Joined: Sep 01, 2003
Posts: 130

I am introducing log4j in my application and succeeded to do so. But now I want to saperate the log in different file according to their LEVEL i.e.

debug log should go in debug.log file and
warn log should go in warn.log file and
similarly other error and info and fatal.

Please help me in the regard.

Syed Saifuddin
Java Developer

Thank You & Best Regards,

Syed Saifuddin,
Senior Software Engineer

SAP Oracle AIX & Java Training
Andy Hahn
Ranch Hand

Joined: Aug 31, 2004
Posts: 225
Create 3 file appenders in your log4j config file.


Then you can set the appender you want to use. Example:
private static final Logger LOG = Logger.getLogger("warnAppender");
LOG.warn("An exception was thrown");
I agree. Here's the link:
subject: Log4j Property
It's not a secret anymore!