如何禁用Logback文件appender的日志

时间:2018-04-09 22:27:45

标签: java logging logback logstash-logback-encoder

我有滚动文件appender设置如下

  <appender name="ACCESS_S3" class="ch.qos.logback.core.rolling.RollingFileAppender">
    <file>/opt/mycompany/${application}-server/access/localwebserver.extended.log
    </file>
    <append>true</append>
    <rollingPolicy
            class="com.mycompnay.logback.core.rolling.S3TimeBasedRollingPolicy">
        <fileNamePattern>/opt/mycompany/${application}-server/access/%d{yyyy-MM-dd-HHmm}.log
        </fileNamePattern>
        <maxHistory>60</maxHistory>
        <configBucketKey>com.mycompany.log.bucket</configBucketKey>
        <s3FolderName>
            ${application}/access/${servername}_
        </s3FolderName>
    </rollingPolicy>
    <encoder>
        <pattern>${encoderPattern}</pattern>
    </encoder>

但我从appender本身得到关于文件上传,重命名等在控制台上的日志,如 - &gt;

INFO in c.q.l.core.rolling.TimeBasedRollingPolicy@1481886288 - Uploading /opt/mycompnay/myapp-server/access/2018-04-09-1542.log

我想禁用上面的日志,我该怎么做?

1 个答案:

答案 0 :(得分:2)

降低TimeBasedRollingPolicy类的日志记录级别

<logger name="ch.qos.logback.core.rolling.TimeBasedRollingPolicy" 
   level="ERROR">
   <appender-ref ref="ACCESS_S3" />
</logger>