File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Open Source Projects and the fly likes log4j log files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "log4j log files" Watch "log4j log files" New topic
Author

log4j log files

Sangeetha Rao
Ranch Hand

Joined: Aug 01, 2005
Posts: 33
I am using log4j in a project where the web server is Tomcat. After the project is executed, the log file contains many DEBUG information apart from those that I have logged. How to prevent such junk debug messages from being logged into my log file.
KArol Muszynski
Ranch Hand

Joined: Aug 09, 2005
Posts: 45
Read about category.priority and logger.level parameters from log4j configuration file. Changing them will help You to prevent unwanted data to be logged.
Also in logger tag, You can filter data to be logged only from Your packages.

helpful link: http://wiki.apache.org/logging-log4j/Log4jXmlFormat

Best Regards,
KArol Muszynski
Sangeetha Rao
Ranch Hand

Joined: Aug 01, 2005
Posts: 33
That really was a useful link. Thanks a lot. But my problem is this: I am aware of the priority levels. I have given the level for the appender as DEBUG. This means any message logged with any of DEBUG, INFO, WARN, ERROR, FATAL levels will go into this log file. But the problem here is that the log file contains certain DEBUG level messages that I havent logged anywhere in my application. I guess they are server logs coming into my log file. How can I filter them ?
Bernhard B�hm
Greenhorn

Joined: Aug 30, 2005
Posts: 3
Maybe a rootCategory would help you, where you define:
-------------
log4j.rootCategory=INFO, FILE
-------------
where "FILE" must then redirect to your log file settings.

So I guess all logging information with category INFO or higher will be logged, and, if you define a special category for your logging messages, you can also DEBUG your own messages...

Didn't try it out, hope it works!
KArol Muszynski
Ranch Hand

Joined: Aug 09, 2005
Posts: 45
Originally posted by S.Sangeetha Rao:
I guess they are server logs coming into my log file. How can I filter them ?


For example You can write Your own filter:




Best Regards,
KArol Muszynski
 
Consider Paul's rocket mass heater.
 
subject: log4j log files