Below exception handler that is common for all my controllers, is working fine except that I need to disable the WARN log from AbstractHandlerExceptionResolver
class after processing the exception. Using Spring Web MVC 5.x version.
@ControllerAdvice
public class AllExceptionHandler{
@ExceptionHandler(SomeCustomException.class)
@ResponseStatus(HttpStatus.BAD_REQUEST)
public void exceptionHandler() {
}
}
This is the log that is generated which I'm trying to avoid:
02-20-2019 15:22:54,896 WARN [http-nio-8080-exec-1] (AbstractHandlerExceptionResolver.java:140) - Resolved [com.rasa.rrt.ste.controller.SomeCustomException]
I'm not using Spring Boot.
Tried to extend the above AllExceptionHandler
class with ExceptionHandlerExceptionResolver
and call warnLogCategory(null)
in the AllExceptionHandler
constructor, but it throws NullPointerException
.
Also, I see on Google to set this property spring.mvc.log-resolved-exception=false
to disable warning, but not sure where/how to set it.