[
https://issues.apache.org/jira/browse/LOG4J2-904?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15361860#comment-15361860
]
Bernhard Mähr commented on LOG4J2-904:
--------------------------------------
In fact I don't know and haven't tried it.
But my changes shouldn't make it worse cause my changes try to rename the file
in two different ways (it was tried before in one of the ways) and then the
file is copied and the old file deleted like before. Only if the deletion fails
(what happend in my case often) it tries to delete the content of the file
without deleting the file. And this seams to work so instead of getting a copy
of the file and appending the content further to the original file the content
of the original file is really truncated on my system.
> RollingFile appender doesn't zip and create new files
> -----------------------------------------------------
>
> Key: LOG4J2-904
> URL: https://issues.apache.org/jira/browse/LOG4J2-904
> Project: Log4j 2
> Issue Type: Bug
> Components: Appenders
> Affects Versions: 2.1
> Environment: Windows 7
> Reporter: Stephen A. Weinfield
> Fix For: 2.6.2
>
>
> Using TimeBasedTriggeringPolicy, with a filePattern of
> {{f:/Log4J/$$\{date:yyyy-MM}/IIB-%d\{MM-dd-yyyy}-%i.log.zip}} and a fileName
> of f:/Log4J/IIB.log:
> on date change, directory is created but filename is not zipped. Also old
> file is not cleared out, but just appended to.
> Log4j2.xml:
> {code}
> <Configuration status = "warn" name = "Log4j2_Configuration" monitorInterval
> = "60" packages = "">
> <Appenders>
> <RollingFile name = "RollingFile" fileName = "f:/Log4J/IIB.log"
> filePattern = "f:/Log4J/$${date:yyyy-MM}/IIB-%d{MM-dd-yyyy}-%i.log.zip" >
> <PatternLayout>
> <Pattern>%d %p %c{1} %m%n%n</Pattern>
> </PatternLayout>
> <Policies>
> <TimeBasedTriggeringPolicy interval = "1" modulate = "true"/>
> </Policies>
> <DefaultRolloverStrategy fileIndex = "min" max = "7"
> compressionLevel = "5"/>
> </RollingFile>
> </Appenders>
> <Loggers>
> <Root level = "trace">
> <AppenderRef ref = "RollingFile" level = "warn"/>
> </Root>
> </Loggers>
> </Configuration>
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]