2013-08-26 77 views
0

我正在使用Weblogic 10.3.6,我無法控制2個不同appender的不同日誌級別(com.my & root) 對於給定的logback.xml,我期望只有文件appender的TRACE級別,在weblogic終端下。問題是我得到了兩個相同的輸出。Logback/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> 

回答

相關問題