This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
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

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
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!