You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-user@logging.apache.org by Alexander Baur <al...@eads.com> on 2007/04/25 08:14:26 UTC

Get logpath from configuration file

Hi,

is there any chance to get the logpath from the variable "File" in the 
configuration file?

Which log4cxx file reads the path from the configuration file? Maybe there is 
a method to get the logpath?

I need to check the directory where the logfiles are stored to roll over them 
and build my own logfile history. Right now I've only got the chance to check 
fixed direcotries.
For example: when i set logpath to ${DIR}/logfile.log i can check the path 
stored in ${DIR} or i just set it to the project directory.

But now I want to set the path in the config file e.g. 
to /folder/anotherfolder/${DIR}/logfile.log so I need to read the "File" 
variable from the configuration file.


Hope someone can help me.

Regards,

Alex



Re: Get logpath from configuration file

Posted by Alexander Baur <al...@eads.com>.
I forgot:

I'm using a Rollingfileappender with this configuration

log4j.rootLogger=debug, R
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=${DIR}/logfile.log
log4j.appender.R.MaxFileSize=100KB

# Keep one backup file
log4j.appender.R.MaxBackupIndex=1

log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%d [%t] %-5p %c - %m%n