File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes log4j working, but writing log file to wrong directory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "log4j working, but writing log file to wrong directory" Watch "log4j working, but writing log file to wrong directory" New topic
Author

log4j working, but writing log file to wrong directory

Bob Peterson
Ranch Hand

Joined: Jul 30, 2004
Posts: 47
I'm using Tomcat 5.5.25 and log4j-1.2.15 on a WinXP system. I think I have my classpath issues resolved because log4j is writing to my log file that is defined in my log4j.xml file. However, it's writing it to $CATALINA_HOME\bin.

I remember when doing log4j in Websphere, we had to put in a kind of file prefix for our log files, something like '../opt/......my.log'. Is there a similar prefix that is needed in Tomcat, to direct it to my webapp directory? Ideally, I'd like it under /webapps/mywebapp/logs.

Here's the relevant snippet of my log4j.xml :

Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

Right now the file is going to Tomcat's current working directory, because you specified a relative path. But if you want the file to go to a specific directory, there's nothing wrong with saying so:
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: log4j working, but writing log file to wrong directory