Spring boot - Cannot turn off logging
Solution 1
To answer my own question: after trial and error, I finally ended up with the following which suppresses all output on startup via the application.properties
file:
logging.level.root=OFF
logging.level.org.springframework.boot=OFF
spring.main.banner-mode=OFF
Solution 2
Add the following to the the package of your choice.
logging.level.<package>=OFF
logging.level.root=OFF
doesn´t work for me
Related videos on Youtube
berimbolo
Updated on October 27, 2022Comments
-
berimbolo over 1 year
I am trying to turn off the console output in STS for a spring boot application using the application.properties file.
Setting the value logging.level.root does seem to have some effect but I can never turn it off completely and nor can I turn off the auto configuration report output.
logging.level.root=OFF spring.main.banner-mode=OFF [email protected]@
The banner does get turned off by the property spring.main.banner-mode.
For some reason with the above properties I still get DEBUG output from spring on startup:
2017-05-09 15:33:16.744 DEBUG 11772 --- [ main] .b.l.ClasspathLoggingApplicationListener : Application started with classpath: 2017-05-09 15:33:16.798 DEBUG 11772 --- [ main] o.s.boot.SpringApplication : Loading source class
There are more lines telling me which properties files are being loaded but I dont want to fill up this post with them.
Following from this I then get the autoconfiguration report output.
I am wondering if I have a configuration issue and if this would cause spring to continue to output on start up?
-
berimbolo about 7 yearslogging.level.org.springframework.*=OFF doesnt seem to have any effect either.
-
kimy82 about 7 yearsI think it is without .* just logging.level.org.springframework=OFF
-
berimbolo about 7 yearsI tried it without the '*' and with just the '.' after too, nothing works. I have tried to turn it off in application.yml too and that also doesnt turn off debugging completely, I still get DEBUG output from spring boot.
-
berimbolo about 7 yearsI guess I will have to try by creating a custom logback.xml but I dont really understand why which is frustrating!
-
berimbolo about 7 yearsOne thing I have noticed is setting root level logger to off means I only get DEBUG output from spring on start up, removing this I get DEBUG and INFO output. So setting the root debugger to off has some effect, just no the desired effect.
-
berimbolo about 7 yearsI wonder if the properties I posted in my answer will suppress the output in your applications?
-
kimy82 about 7 yearsAs fas as I know logging.level.root=OFF turns off logging. However if you specify another level for another package it will override previous rule. So, logging.level.root=OFF logging.level.org.springframework.web=DEBUG will log debug level in org.springframework.web package
-
berimbolo about 7 yearsIm not specifying anything just using the springboot starters and @SpringBootApplication