slf4j,重新登录,已存在名为的目标压缩文件

时间:2018-09-07 08:48:39

标签: logback slf4j logback-classic

logback 1.1.5 + slf4j 1.7.4。

半夜滚动

 00:00:00,163 |-INFO in c.q.l.co.rolling.helper.RenameUtil - Renaming file [/opt/wls/appl/log/out.log] to [/opt/wls/appl/log/out.log1294410077875834.tmp]
 00:00:00,164 |-INFO in ch.qos.logback.core.rolling.helper.Compressor - ZIP compressing [/opt/wls/appl/log/out.log1294410077875834.tmp] as [/opt/wls/appl/log/archive/out/out-2018-09-04.10.zip]

但是几秒钟后,翻转又开始了

 00:01:52,551 |-INFO in c.q.l.co.rolling.helper.RenameUtil - Renaming file [/opt/wls/appl/log/out.log] to [/opt/wls/appl/log/out.log1294522459498363.tmp]
 00:01:52,551 |-WARN in ch.qos.logback.core.rolling.helper.Compressor - The target compressed file named [/opt/wls/appl/log/archive/out/out-2018-09-04.0.zip] exist already.

WLS的2个虚拟服务器上有2个应用程序。这两个应用程序都使用单独的主文件夹以及自己的logback.xml。

logback.xml是

<appender name="ROLLING" class="ch.qos.logback.core.rolling.RollingFileAppender">
    <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
        <fileNamePattern>${PRG_HOME}/logs/out/out-%d{yyyy-MM-dd}.%i.zip</fileNamePattern>
        <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
            <maxFileSize>100MB</maxFileSize>
        </timeBasedFileNamingAndTriggeringPolicy>
    </rollingPolicy>
    <encoder>
        <pattern>%d{dd/MM/yyyy HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n%ex</pattern>
    </encoder>
</appender>
<appender name="ASYNC_COMMON" class="ch.qos.logback.classic.AsyncAppender">
    <queueSize>32000</queueSize>
    <appender-ref ref="ROLLING" />
</appender>

我该怎么办?

1 个答案:

答案 0 :(得分:0)

您可以尝试将<svg width="134" height="134" viewBox="0 0 134 134" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" fill="#000" stroke-linejoin="round" d=" M1 67.388 c.019 36.919 29.394 66.243 66.32 66.208 c36.871-.035 66.285-29.472 66.272-66.322 C133.58 30.515 103.99 4.979 67.208 1 C30.383 1.02 1.981 30.503 1 67.388z m40.332 19.774 c-.001-5.624 1.68-5.857 6.035-5.941 c4.615-.091 5.879 1.391 5.885 5.94 c1.005 4.635 -1.426 5.956 -5.988 5.954 c-4.646 -.002 -5.932-.632 -5.932-5.954z m5.683-46.129 c4.745 0 6.4 1.813 6.222 5.768 c-.159 4.2 -.727 6.398 -5.692 6.235 c-4.257-.139 -6.411-.852 -6.1-5.77 c2.252-3.983 0-6.505 5.57-6.23z m42.203-7.042 s3.979 3.479 5.616 5.05 c 21.936 22.036 13.345 44.103 .445 57.11 c1.001 0 2.744 3.34 4.633 4.948 c 17.013-11.334 24.77-47.625-.538-67.109z"/></svg>添加到<prudent>true</prudent>中。这应该允许多个JVM安全地写入同一文件。

尽管有一些restrictions适用于RollingFileAppender模式。例如,不允许压缩日志文件。