Configuring directory path for fileappender in log4j.properties
807598Oct 31 2006 — edited May 30 2008I want to write log data to a file where the directory path of the file should be picked from a unix environmental variable. How can you configure this in log4j.properties?
*******************************************************
log4j.rootLogger=INFO, A
# A is set to be a FileAppender.
log4j.appender.A=org.apache.log4j.FileAppender
# A uses PatternLayout.
log4j.appender.A.File=$UNIX_ENV_VARIABLE/A.log <= This is what I want. The dir path should be picked from some env path
log4j.appender.A.layout=org.apache.log4j.PatternLayout
log4j.appender.A.layout.ConversionPattern=%d{HH:mm:ss,SSS} [%t] %-5p %c %x - %m%n
*******************************************************
Or if this should be done in code, then please guide me on that.
Thanks in advance