Shady
Shady

Reputation: 804

Relative path to log4j.xml in Spring MVC Project using Tomcat

Im trying to configure log4j with a relative path to put the .log-Files to. Files are correctly getting generated when I specify a absolute path but are not generated AT ALL when i use something else. I tried the following

I am working on a Mac with the Spring Source Tools and the project I created with the Spring Source Tools put the log4j.xml into src/main/resources and NOT into the WEB-INF folder as stated in most of the tutorials. I tried variant 3 (webapp.root...) and it actually finds the log4j.xml where I declare it (I put it into WEB-INF and it works) but still no logging to a file when I use ${webapp.root}.

How do you solve that problem? This is horrible, I cant push this stuff to our repo with an absolute path to my user-dir??

Thank you in advance!!

Upvotes: 0

Views: 1232

Answers (1)

Shaun Hare
Shaun Hare

Reputation: 3871

In appenders in src/main/resources/log4j.xml we use

 <param name="file" value="${catalina.home}/logs/catalina.out"/>

Also check permissions? - hope that helps

Upvotes: 2

Related Questions