3

I am using Spring Boot and want to completely disable the automatic logging configuration and use SLF4J and logback directly instead.

I've tried the following:

@EnableAutoConfiguration(exclude={LoggingApplicationListener.class})

Which didn't work. Is there a way to completely disable the spring boot logging configuration?

Ali Ben Messaoud
  • 11,690
  • 8
  • 54
  • 87
binarylegit
  • 319
  • 1
  • 4
  • 15

3 Answers3

2

I believe that Spring uses a property that overrides the configuration set by default and the annotation you're using.

I once had the same problem and I solved it by specifying the following:

-Dlogging.config=log4j-live.xml -Dlog4j.debug

Let me know if that works for you.

Marcelo Tataje
  • 3,849
  • 1
  • 26
  • 51
  • This only tells spring where to find the config file. I am trying to completely disable the spring configuration of logging altogether. – binarylegit Apr 17 '15 at 21:43
1

Check out Dave Syer's answer. I think it is the best thing you can do to erase Spring Boot default logging config.

Spring Boot programmatic logging configuration

Community
  • 1
  • 1
Rafal G.
  • 4,252
  • 1
  • 25
  • 41
1

In case you don't want to configureJAVA_OPTS, you can override behaviour of SpringBootServletInitializer as described in Spring Boot: LoggingApplicationListener interfering with Application Server logging

jediz
  • 4,459
  • 5
  • 36
  • 41