Reputation: 313
I am using Weblogic 10.3.6 and I am not able to control different log level for 2 different appenders (com.my & root) With the given logback.xml I am expecting a TRACE level only for the file appender and nothing under weblogic terminal. Issue is I get the same output on both.
<?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>
Upvotes: 0
Views: 1251
Reputation: 135
I would say that setting additivity flag would help you:
<logger name="com.my" level="trace" additivity="false">
<appender-ref ref="file" />
</logger>
See http://logback.qos.ch/manual/configuration.html#overrridingCumulativity.
Upvotes: 2