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

Ralph Goers commented on LOG4J2-2517:
-------------------------------------

In the log I see 
{code}
Setting prev file time to 2018-09-25T18:40:48.677+0100
{code}
and then
{code}
Unable to move file K:\clem\dev\Analyser\Orchestrator\logs\orchestrator.log to 
K:\clem\dev\Analyser\Orchestrator\logs\orchestrator-09-25-18-18-40-48-3.log: 
java.nio.file.FileSystemException 
K:\clem\dev\Analyser\Orchestrator\logs\orchestrator.log -> 
K:\clem\dev\Analyser\Orchestrator\logs\orchestrator-09-25-18-18-40-48-3.log: 
The process cannot access the file because it is being used by another process.
{code}
With the new code that is in place that will be the time the file was created, 
so somehow you are pointing to a file that was created on Sept 25 and something 
must still be accessing it. With your configuration and what the logs show is 
that there is only a single output stream for this file. Even if we did open it 
multiple times I am still not sure that you would get this message unless a 
second process was running and had the file open.

> RollingFileManager OnStartupTriggeringPolicy never rolls the file on startup
> ----------------------------------------------------------------------------
>
>                 Key: LOG4J2-2517
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2517
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Appenders
>    Affects Versions: 2.11.1
>            Reporter: Jon Hanson
>            Priority: Minor
>         Attachments: log4j2.json, log4j2_debug.log
>
>
> I'm trying to get log4j2 (V2.11.1) to roll the existing log file at startup 
> before it starts logging into a new file. My config is atached to the jira. 
> I'm using a RollingFileManager with a OnStartupTriggeringPolicy with 
> minSize=0, which, according to the documentation should be sufficient.
> However what i'm finding is that at startup, the 
> {{OnStartupTriggeringPolicy}} class {{initialize}} method compares the 
> timestamp of the log file to the JVM startup, and if the log file time is 
> after the start-up time then it won't roll the file. If I step through the 
> code then I see that at the point that check is made the file time is always 
> after the JVM start time, because log4j2 appears to have already opened the 
> file for writing at that point.
> More info here:
> [https://stackoverflow.com/questions/53632091/log4j2-rollingfilemanager-onstartuptriggeringpolicy-never-rolls-the-file-on-star]
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to