Win a copy of Rust Web Development this week in the Other Languages forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

log4j: Why aren't I seeing output in my log file?

 
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I'm using Tomcat 6.0.24 and log4j 1.2.16. Nothing is appearing in my log4j logs as defined by my properties files and I was looking to get some insight as to why. Here is my log4j.properties, located in my war file's WEB-INF/classes directory ...



I'm creating the logger and using it in the code below. The System.err.println statement is printed in my catalina.out file, so I know the branch of code is being invoked ...



Any help as to why nothing is appearing in my logs is appreciated, - Dave
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Where have you kept your log4j.properties. Also you need to initiate log4j. General way to do it initialising in a servlet which is configured in web.xml. See below link

http://www.avajava.com/tutorials/lessons/how-do-i-initialize-log4j-in-a-web-application.html


Also remember to place log4j.properties right under classes folder in output dir.
 
rajeev yadav
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can log4j.properties at any location but you need to tell your app to load it from that location
 
reply
    Bookmark Topic Watch Topic
  • New Topic