logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Retter <adam.ret...@googlemail.com>
Subject Write log files relative to log4j2.xml?
Date Tue, 09 Jun 2015 19:08:54 GMT
Hi there,

Is it somehow possible to specify that the log4j2 log files should be
written somewhere relative to the configuration file?

For example my config file is here - /somewhere/my-app/logj2.xml

I would like to ensure that regardless of which folder my application
is started from then my log files are always written to -

My log4j2.xml has something like this -

        <RollingRandomAccessFile name="my-app"
filePattern="var/log/my-app.log.gz" fileName="var/log/my-app.log">
                <SizeBasedTriggeringPolicy size="10MB"/>
            <DefaultRolloverStrategy max="14"/>
            <PatternLayout pattern="%d [%t] %-5p (%F [%M]:%L) - %m %n"/>

However, var/log/my-app.log is always written relative to the folder
where my-app is started from and not relative to where the config file

Any ideas?

Adam Retter

skype: adam.retter
tweet: adamretter

To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org

View raw message