As of slf4j
version 1.7.26
, I was able to change the logging level.
Here is the logback.xml
in the source folder. In case of spring boot app, you might want to place it in the resources folder.
<configuration scan="true" scanPeriod="20000">
<include file="C:/logback-ext.xml"/>
</configuration>
The logback-ext.xml
file is kept at any external location. The scanPeriod
is in milliseconds. In case this fails, try using include resource
instead of include file
in logback.xml
.
<included>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>
%d{yyyy-MM-dd HH:mm:ss} %-5p [%t] --- %c{1}.%M:%L :: %m %n
</pattern>
</encoder>
</appender>
<root level="INFO">
<appender-ref ref="STDOUT" />
</root>
</included>
I was able to change the logging level, logging pattern, attach/ detach new appenders and add/ remove appenders.
These are the dependencies in pom.xml
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
</dependency>
Cheers!