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 Re: Write log files relative to log4j2.xml?
Date Tue, 09 Jun 2015 22:08:28 GMT
Okay thanks Ralph,

How would I go about getting such a change submitted to the project?

On 9 June 2015 at 22:36, Ralph Goers <ralph.goers@dslextreme.com> wrote:
> There is nothing now but I would imagine it wouldn’t be too difficult to add a variable
that contains the base url or path of the configuration file in use.
>
> Ralph
>
>> On Jun 9, 2015, at 12:08 PM, Adam Retter <adam.retter@googlemail.com> wrote:
>>
>> 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: log4j-user-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>



-- 
Adam Retter

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

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


Mime
View raw message