log4j relative file path

Posted by Bob on Stack Overflow See other posts from Stack Overflow or by Bob
Published on 2010-06-04T14:58:13Z Indexed on 2010/12/21 17:54 UTC
Read the original article Hit count: 268

Filed under:
|

Hi,

I'd like my web app to log into files with this path: webapp/logs/

I can set the absolute path in the log4j.properties file, but the production environment's directory structure will be different. Is there any way I could do it?

Here is how I do:

log4j.appender.f=org.apache.log4j.RollingFileAppender
log4j.appender.f.layout=org.apache.log4j.PatternLayout
log4j.appender.f.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
log4j.appender.f.File=log.out
log4j.appender.f.MaxFileSize=100KB

This is printing logs into a file named log.log in my eclipse directory (c://eclipse). I'm using Tomcat 6.

© Stack Overflow or respective owner

Related posts about java

Related posts about log4j