Als Titel erwähnt, manchmal RollingFile appender Datei konnte nicht gz einzuloggen, manchmal werde ich xxx.txt manchmal im Archiv-Ordner erhalten xxx.gz, die Config, wie folgend:log4j 2 RollingFile einige Male gescheitert log gz Datei
<RollingFile name="dev1Log" fileName="E:/test/logs/dev1Log.txt"
filePattern="E:/test/logs/archived/$${date:yyyy-MM}/dev1Log.txt-%d{yyyy-MM-dd}-%i.txt.gz">
<PatternLayout pattern="%-5p:[%c.class(%c{1}.java:%L)] %m%n"/>
<Policies>
<TimeBasedTriggeringPolicy />
<SizeBasedTriggeringPolicy size="1 M"/>
</Policies>
<DefaultRolloverStrategy max="100"/>
</RollingFile>
Fehlerprotokoll, wie folgend:
2017-09-09 16:26:57,582 ContainerBackgroundProcessor[StandardEngine[Catalina]] T
RACE DefaultRolloverStrategy.purge() took 182.0 milliseconds
2017-09-09 16:26:57,582 ContainerBackgroundProcessor[StandardEngine[Catalina]] D
EBUG RollingFileManager executing synchronous FileRenameAction[E:\andro_web\log4
j\mlWebLogs\xxxdev1Log.txt to E:\andro_web\log4j\mlWebLogs\archived\2017-09\xxxd
ev1Log.txt-2017-09-09-100.txt, renameEmptyFiles=false]
2017-09-09 16:26:57,582 ContainerBackgroundProcessor[StandardEngine[Catalina]] E
RROR Unable to move file E:\andro_web\log4j\mlWebLogs\xxxdev1Log.txt to E:\andro
_web\log4j\mlWebLogs\archived\2017-09\xxxdev1Log.txt-2017-09-09-100.txt: java.ni
o.file.FileSystemException E:\andro_web\log4j\mlWebLogs\xxxdev1Log.txt -> E:\and
ro_web\log4j\mlWebLogs\archived\2017-09\xxxdev1Log.txt-2017-09-09-100.txt: 程序
無法存取檔案,因為檔案正由另一個程序使用。(Chinese means: The program can not access the file because the file is being used by another program.)