1

登录 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>

我能做些什么?

4

1 回答 1

0

您可以尝试添加<prudent>true</prudent>到您的RollingFileAppender. 这应该允许多个 JVM 安全地写入同一个文件。

但是,有一些适用于模式的限制。prudent例如,不允许日志文件压缩。

于 2018-09-13T21:34:05.470 回答