I have a Google Web Toolkit (GWT) - an application that I run in three different modes:
- Deployed on Tomcat
- Hosting
- Junit test
How to configure log4j.properties so that each of these modes works correctly?
If I use ${catalina.base}
, I cannot use it in host mode and in Junit tests, and if I just use relative logs/myapplication.log
, it will not work with Tomcat, because then I get:
java.io.FileNotFoundException: log/myapplication.log (Keine Berechtigung)
I would not mind having logs in the webapps / myapplication / logs files if the log directory could be specified relative to the path to the program, but it would also be nice if the log files were only in / var / log / tomcat 7 / ... or any other log folder.
Currently my log4j.properties contains the following entries for registering files:
log4j.appender.file=org.apache.log4j.FileAppender log4j.appender.file.File=${catalina.base}/logs/myapplication.log log4j.appender.file.layout=org.apache.log4j.PatternLayout log4j.appender.file.layout.ConversionPattern=%c %C %d{ABSOLUTE} %-5p %C{1}: %m%n log4j.appender.file.threshold=DEBUG log4j.appender.file.Append=false
source share