logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralph Goers <ralph.go...@dslextreme.com>
Subject Re: Changing the Attributes on a RollingAppender
Date Wed, 21 Aug 2019 18:27:24 GMT
You can’t atomically swap an appender. If you remove it and then add a new one with the same
name you will lose log events targeted at the appender while it is removed. You could add
a new appender with a different name and then modify all the loggers using the old one to
use the new one, but Log4j won’t do that for you.

What problem are you trying to solve?  Log4j might already have a different way of supporting
it.

Ralph

> On Aug 21, 2019, at 10:44 AM, Fred Eisele <fredrick.eisele@gmail.com> wrote:
> 
> Could construct a new appender and swap it for the old one?
> 
> On Wed, Aug 21, 2019 at 8:39 AM Ralph Goers <ralph.goers@dslextreme.com>
> wrote:
> 
>> No. The file name is immutable.
>> 
>> Ralph
>> 
>>> On Aug 21, 2019, at 6:22 AM, Fred Eisele <fredrick.eisele@gmail.com>
>> wrote:
>>> 
>>> Given a RollingFileAppender is it possible to
>> dyanamically/programmatically
>>> change its fileName?
>>> 
>>>       <RollingFile name="X_PLUGIN_FILE"
>>>                    fileName="x.log}"
>>>                    filePattern="x_%i.log}"
>>>                    ignoreExceptions="false">
>>>           <PatternLayout pattern="#linux %file:%method:%line - %msg%n"
>> />
>>>           <OnDemandTriggeringPolicy />
>>>       </RollingFile>
>>> 
>>> I need to be able to change the log file from my running application
>> plugin.
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> 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


Mime
View raw message