How to set loglevel for specefic class in spring using logBack.xml?
I am trying to not log a debug message in the com.data.march.ClientUtils class. For this, I think that I can change the loglevel of this class in logBack.xml to Error.
Here is a portion of my code:
<appender name="dailyRollingFileAppender"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>c:/Logs/logato.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- daily rollover -->
<FileNamePattern>c:/Logato/Data/Logs/Logato.%d{yyyy-MM-dd}.log
</FileNamePattern>
<!-- keep 30 days' worth of history -->
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<Pattern>%d{HH:mm:ss.SSS} %-5level [%thread] %logger{35} - %msg %n
</Pattern>
</encoder>
</appender>
<appender name="minuteRollingFileAppender"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- rollover every minute -->
<FileNamePattern>c:/Data/Logs/minutes/Logato-minute.%d{yyyy-MM-dd_HH-mm}.log
</FileNamePattern>
<!-- keep 30 minutes' worth of history -->
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<Pattern>%-4relative %-5level [%thread] %logger{35} - %msg %n
</Pattern>
</encoder>
</appender>
<logger name="org" additivity="false">
<level value="INFO" />
<appender-ref ref="dailyRollingFileAppender" />
<appender-ref ref="consoleAppender" />
</logger>
<logger name="com.data" additivity="false">
<level value="DEBUG" />
<appender-ref ref="dailyRollingFileAppender" />
<appender-ref ref="consoleAppender" />
</logger>
<appender name="consoleAppender" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<Pattern>.%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg %n
</Pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>TRACE</level>
</filter>
</appender>
<logger name="org" additivity="false">
<level value="INFO" />
<appender-ref ref="dailyRollingFileAppender" />
</logger>
<logger
name="com.data.march.ClientUtils"
additivity="false">
<level value="ERROR" />
</logger>
<root>
<level value="DEBUG" />
<appender-ref ref="consoleAppender" />
</root>
But my attempt failed. Do you have any ideas?
+3
source to share