我正在使用 Weblogic 10.3.6,但我无法控制 2 个不同的附加程序(com.my 和 root)的不同日志级别使用给定的 logback.xml,我只希望文件附加程序的 TRACE 级别,而 weblogic 终端下没有任何内容. 问题是我在两者上都得到了相同的输出。
<?xml version="1.0" encoding="UTF-8"?>
<!-- For assistance related to logback-translator or configuration -->
<!-- files in general, please contact the logback user mailing list -->
<!-- at http://www.qos.ch/mailman/listinfo/logback-user -->
<!-- -->
<!-- For professional support please see -->
<!-- http://www.qos.ch/shop/products/professionalSupport -->
<!-- -->
<configuration>
<contextName>myContx</contextName>
<jmxConfigurator />
<appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!--See also http://logback.qos.ch/manual/appenders.html#RollingFileAppender-->
<File>/var/log/a.log</File>
<encoder>
<pattern>%d{HH:mm:ss.SSS} %5p %c{1}:%L - %m%n</pattern>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
<maxIndex>1</maxIndex>
<FileNamePattern>/var/log/a.log.%i</FileNamePattern>
</rollingPolicy>
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<MaxFileSize>1MB</MaxFileSize>
</triggeringPolicy>
</appender>
<appender name="out"
class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<pattern>%-4relative [%thread] %-5level %class - %msg%n</pattern>
</layout>
</appender>
<logger name="com.my" level="trace">
<appender-ref ref="file" />
</logger>
<root level="off">
<appender-ref ref="out" />
</root>
</configuration>