[ 
https://issues.apache.org/jira/browse/LOG4J2-1185?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15964923#comment-15964923
 ] 

Juan Loman edited comment on LOG4J2-1185 at 4/11/17 9:12 PM:
-------------------------------------------------------------

It's still not working for me, is it because I'm using a 
{{RollingRandomAccessFileAppender}} instead of a {{RollingFileAppender}}?

*Update:* changing the appender "works", but the files have the time of the 
next interval.  I have a {{TimeBasedTriggeringPolicy}} with {{interval}} of 1 
(minute) and {{modulate}} does not seem to have an effect here.

For example, it's *10:23:40* when starting the application with a pattern of 
{{test.%d\{HH-mm\}.log}}:

# A file {{test.10-23.log}} is created and logs events at that time, as 
expected.
# At *10:24:00*, no new files are created and logging is still appended to he 
previous file.  _This is not expected._
# At *10:25:00*, a file {{test.10-24.log}} is created and starts appending 
entries for minute 10:25.
# At *10:26:00*, a file {{test.10-25.log}} is created and will contain all 
entries for minute 10:26.

I'd expect the time of the log entry to match the time of the filename, so that 
a log event happening at 10:25:32 would be in {{test.10-25.log}} instead of 
{{test.10-24.log}}.

Am I missing something?


was (Author: jualoman):
It's still not working for me, is it because I'm using a 
{{RollingRandomAccessFileAppender}} instead of a {{RollingFileAppender}}?

> 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
>            Assignee: Ralph Goers
>             Fix For: 2.8
>
>
> 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. If I initialized my fileName 
> using $\{date:yyyy-MM-dd\}, date would be substituted only once during 
> initialization and it would never change, always continue to log in the same 
> log file (until I restart my application).



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-dev-h...@logging.apache.org

Reply via email to