The result?
log4j:ERROR setFile(null,true) call failed.No worries, though; the application comes up just fine, and logs where you expect... If you're lucky and don't have a security manager.
java.io.FileNotFoundException: /logs/spring.log (No such file or directory)
at java.io.FileOutputStream.openAppend(Native Method)
at java.io.FileOutputStream.(FileOutputStream.java:177)
at java.io.FileOutputStream.(FileOutputStream.java:102)
at org.apache.log4j.FileAppender.setFile(FileAppender.java:289)
at org.apache.log4j.FileAppender.activateOptions(FileAppender.java:163)
at org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:256)
at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:132)
[...]
With a security manager, you get a nice, fatal AccessControlException.
Bah.
The fix is simple: move log4j.properties away from the classpath root, e.g. into /WEB-INF.
No comments:
Post a Comment