| Author |
log4j: Why aren't I seeing output in my log file?
|
Dave Alvarado
Ranch Hand
Joined: Jul 02, 2008
Posts: 434
|
|
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
|
 |
rajeev yadav
Greenhorn
Joined: Mar 28, 2011
Posts: 26
|
|
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
Joined: Mar 28, 2011
Posts: 26
|
|
|
You can log4j.properties at any location but you need to tell your app to load it from that location
|
 |
 |
|
|
subject: log4j: Why aren't I seeing output in my log file?
|
|
|