Logback排除指定包/类/方法日志输出
排除指定包/类/方法日志输出
如下为 logback.xml 的配置
<springProfile name="pro">
<appender name="BUSINESS_API" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>/data/log/${projectName}/api_${projectName}.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>/data/log/${projectName}/api_${projectName}-%d{yyyy-MM-dd}.log</fileNamePattern>
</rollingPolicy>
</appender>
<logger name="com.imooc" level="info" additivity="false">
<appender-ref ref="BUSINESS_API"/>
</logger>
<!-- 以下为要排除的 包,类,方法 -->
<logger name="com.alibaba.nacos.client.config.http" level="OFF" />
<logger name="com.alibaba.nacos.client.config.http.ServerHttpAgent" level="OFF" />
<logger name="com.alibaba.nacos.client.config.http.ServerHttpAgent.httpPost" level="OFF" />
</springProfile>
使用还是很简单的