• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

log4j log files

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ?
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
reply
    Bookmark Topic Watch Topic
  • New Topic