0

I am using spring boot for service development and logback for logging using slf4j

I have Async annotation on one of my classes that sometimes throws errors and logs them. I don't want to log such error created by Async and would want to suppress such errors being logged on STDOUT.

I tried logging.org.springframework=false but in vain.

Is there a way to accomplish this?

Ray S
  • 569
  • 1
  • 8
  • 18

2 Answers2

0

Assuming the @Async annotation is used in class org.mypackage.MyClass.java you would specify an entry in your application.properties file declaring the desired log level. In your case 'OFF'.

logging.level.org.mypackage.myclass=OFF

Jeff J
  • 26
  • 3
  • that would suppress other custom logs as well in that class. Wouldn't it be better to just do logging.level.org.springframework=OFF? And you you had suggested didn't work with logback – Ray S Nov 13 '18 at 22:06
  • Can you post a code example and describe the type of logging you do/don't want to see? – Jeff J Nov 14 '18 at 19:17
0

If you want to skip logging in spring boot you can completely disable it by using logging.level.root=OFF logging.level.org.springframework.boot=OFF

Or you can turn of a spring boot LoggingSystem by setting System.property(SYSTEM_PROPERTY,NONE) Here is link on LoggingSystem:

https://docs.spring.io/spring-boot/docs/current/api/org/springframework/boot/logging/LoggingSystem.html

I think this may help

Mykhailo Moskura
  • 2,073
  • 1
  • 9
  • 20