[
https://issues.apache.org/jira/browse/LOG4J2-2591?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16869550#comment-16869550
]
Davide Martusciello commented on LOG4J2-2591:
---------------------------------------------
same problem to me! With CronTriggeringPolicy suggested from [~philippfels]
same problem.
* +Downgrade Log4j2 to version 2.11.1 solve my problem.(y)+
* +With version 2.11.2, using RollingRandomAccessFile solve this issue(y)+
this is my configuration:
{code:xml}
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="TRACE" monitorInterval="30" ignoreExceptions="false">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%m%n" />
</Console>
<RollingFile name="DailyRoll" append="true"
fileName="logs/mtrace.log"
filePattern="logs/$${date:yyyy-MM}/mtrace-%d{yyyy-MM-dd}.log">
<PatternLayout>
<Pattern>%d{yyyy-MM-dd HH:mm:ss} %-5p
%C{1}:%T:%L - %m%n</Pattern>
</PatternLayout>
<Policies>
<CronTriggeringPolicy schedule="0 0 * * * ?"/>
<TimeBasedTriggeringPolicy interval="1"
modulate="true" />
</Policies>
</RollingFile>
</Appenders>
<Loggers>
<Logger name="mts" additivity="true" level="trace">
<AppenderRef ref="DailyRoll" />
</Logger>
<Root level="trace">
<AppenderRef ref="Console" />
</Root>
</Loggers>
</Configuration>
{code}
*Environment Windows 10 - Java version: 1.8.0_111*
> RollingFileAppender don't append log file after restart service.
> ----------------------------------------------------------------
>
> Key: LOG4J2-2591
> URL: https://issues.apache.org/jira/browse/LOG4J2-2591
> Project: Log4j 2
> Issue Type: Bug
> Components: Appenders
> Affects Versions: 2.11.2
> Environment: Windows Server 2008 R2 & Windows 10
> OpenJDK Runtime Environment 11.0.2
> Java 11
> Reporter: Philipp Fels
> Priority: Major
> Labels: 11.0.2, Java, Windows
>
> The RollingFileAppender dosn't append to the current log file after restart
> of Service at Windows.
> At UNIX Systems it works as expected.
> Our log4j2 Configuration:
>
> {code:java}
> <?xml version="1.0" encoding="UTF-8"?>
> <Configuration status="WARN"
> packages="de.uplanet.lucy.server.portalserver.messages"
> shutdownHook="disable">
> <Properties>
> <Property name="de.uplanet.lucy.logPath">log</Property>
> </Properties>
> <Appenders>
> <!-- File appender configuration (daily rotation) -->
> <RollingFile name="DailyFile"
> fileName="${sys:de.uplanet.lucy.logPath}/portal.log"
> filePattern="${sys:de.uplanet.lucy.logPath}/portal.%d{yyyy-MM-dd}.log">
> <PatternLayout>
> <pattern>%-5p %d{ISO8601}{UTC}Z - %c[%t]%n %m%n</pattern>
> </PatternLayout>
> <Policies>
> <TimeBasedTriggeringPolicy interval="1"/>
> </Policies>
> <ThresholdFilter level="DEBUG" onMatch="ACCEPT"
> onMismatch="DENY"/>
> </RollingFile>
> <Loggers>
> <!-- Set root logger level -->
> <Root level="WARN">
> <AppenderRef ref="DailyFile"/>
> </Root>
> <Logger name="de.uplanet" level="info" additivity="false">
> <AppenderRef ref="DailyFile"/>
> </Logger>
> </Loggers>
> </Configuration>
> {code}
> If you have a new Installation it works as expected, after a few days we have
> this behavior:
> Example at 16.04.2019:
> After an restart of the service, the content portal.log will be copied in a
> file with that name portal.15-12-2018.log. the 15th december 2018 is the
> creation date of the log folder where the logs are saved.
> And after that the old content in portal.log will be deleted.
> New log content will be logged in the empty portal.log
>
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)