Reputation: 10947
In my logback-spring.xml if I include logger level as INFO it is working fine but for other than INFO(WARN,ERROR) even application is not loading.After below log in console applicatiton booting is stopped forever.This is the link we tried for this.Any help is appreciable.
Output in Console as log:
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.5.2.RELEASE)
logback-spring.xml
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<include resource="org/springframework/boot/logging/logback/base.xml" />
<appender name="consoleAppender" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<Pattern>%d{yyyy-MM-dd 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>
<appender name="minuteRollingFileAppender"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<FileNamePattern>/usr/src/app/logs/test%d{yyyy-MM-dd_HH-mm}.log
</FileNamePattern>
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<Pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{35}-%msg %n</Pattern>
</encoder>
</appender>
<springProfile name="dev,staging">
<root>
<level value="INFO" /><!--ERROR not working -->
<appender-ref ref="minuteRollingFileAppender" />
<appender-ref ref="consoleAppender" />
</root>
</springProfile>
</configuration>
Upvotes: 2
Views: 3227
Reputation: 12734
The Spring-boot banner could be explicit included or excluded from the console. There are settings in some IDE's to do that.
If you dont have any logs for log level different than INFO
you will only see the banner for application start. It looks like the application does not start but thats just because there are no logs written.
Excluding the banner in application.properties
:
spring.main.banner-mode=off
or in main
:
SpringApplication app = new SpringApplication(SpringBootConsoleApplication.class);
app.setBannerMode(Banner.Mode.OFF);
app.run(args);
Upvotes: 2