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 -
/somewhere/my-app/var/log

My log4j2.xml has something like this -

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

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
is.

Any ideas?

-- 
Adam Retter

skype: adam.retter
tweet: adamretter
http://www.adamretter.org.uk

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to