Log4j FileAppender not logging to file

This happens often when you don’t give the absolute path in log4j config file. For example, I gave the path as this log4j.appender.fileout.File=${webapp.root}/WEB-INF/log4j.log . And log4j was creating a file in d:/tomcat/webapps/myapp/WEB-INF/ but the file was empty even though I could see the logs in the console. Then after pulling some hair, I found there was directory created at “d:/WEB-INF” which had a log4j.log file and log4j was logging to this file. I had this issue with tomcat 6.0.18. After setting the absolute path, I was able to see the logs where I wanted them to go.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: