[ 
https://issues.apache.org/jira/browse/LOG4J2-1185?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dhwaneet Bhatt updated LOG4J2-1185:
-----------------------------------
    Description: 
Right now RollingFileAppender rolls over the current file with fileName to the 
one generated by FilePattern. However, logging always continues in the same 
fileName i.e. fileName once created cannot be changed.

Property Substitution is only once during initialization, fileName is never 
changed after RollingFileManager is initialized. The RollingFileManager is very 
tightly tied up to the fileName attribute.

Consider that I want to name my log files like this using RollingFileAppender:

mylog-2015-10-30.log
mylog-2015-10-29.log
mylog-2015-10-28.log

There is no good way to achieve this, because even after rolling over the file, 
the fileName would still remain the same, as I initialized fileName using 
$\{date:yyyy-MM-dd\}, and it would never change.

Implementing this is much easier, I just have to write a new rollover strategy 
which has to create a new file based on the current file pattern. But the 
RollingFileManager is so intricately tied with the fileName, that it is not 
possible to change the primary file where logging is performed in any ways.

  was:
Right now RollingFileAppender rolls over the current file with fileName to the 
one generated by FilePattern. However, logging always continues in the same 
fileName i.e. fileName once created cannot be changed.

Property Substitution is only once during initialization, fileName is never 
changed after RollingFileManager is initialized. The RollingFileManager is very 
tightly tied up to the fileName attribute.

Consider that I want to name my log files like this using RollingFileAppender:

mylog-2015-10-30.log
mylog-2015-10-29.log
mylog-2015-10-28.log

There is no good way to achieve this, because even after rolling over the file, 
the fileName would still remain the same, as I initialized fileName using 
${date:yyyy-MM-dd}, and it would never change.

Implementing this is much easier, I just have to write a new rollover strategy 
which has to create a new file based on the current file pattern. But the 
RollingFileManager is so intricately tied with the fileName, that it is not 
possible to change the primary file where logging is performed in any ways.


> Ability to change the fileName dynamically in RollingFileAppender
> -----------------------------------------------------------------
>
>                 Key: LOG4J2-1185
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1185
>             Project: Log4j 2
>          Issue Type: New Feature
>          Components: Appenders
>    Affects Versions: 2.1
>            Reporter: Dhwaneet Bhatt
>
> Right now RollingFileAppender rolls over the current file with fileName to 
> the one generated by FilePattern. However, logging always continues in the 
> same fileName i.e. fileName once created cannot be changed.
> Property Substitution is only once during initialization, fileName is never 
> changed after RollingFileManager is initialized. The RollingFileManager is 
> very tightly tied up to the fileName attribute.
> Consider that I want to name my log files like this using RollingFileAppender:
> mylog-2015-10-30.log
> mylog-2015-10-29.log
> mylog-2015-10-28.log
> There is no good way to achieve this, because even after rolling over the 
> file, the fileName would still remain the same, as I initialized fileName 
> using $\{date:yyyy-MM-dd\}, and it would never change.
> Implementing this is much easier, I just have to write a new rollover 
> strategy which has to create a new file based on the current file pattern. 
> But the RollingFileManager is so intricately tied with the fileName, that it 
> is not possible to change the primary file where logging is performed in any 
> ways.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to