• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

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

 
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
 
Look ma! I'm selling my stuff!
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!