Skip to content

Unhandled exceptions are not logged with WebFlux #15769

@sdeleuze

Description

@sdeleuze

Consider this simple controller:

@RestController
public class FooController {
	@GetMapping("/")
	public String foo() {
		throw new RuntimeException("foo");
	}
}

With Spring Boot 2.1.2 and Spring MVC:

2019-01-23 12:13:22.249 ERROR 7563 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.RuntimeException: foo] with root cause

java.lang.RuntimeException: foo
	at com.example.demologgingerrors.FooController.foo(FooController.java:11) ~[classes/:na]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_181]
	...

With Spring Boot 2.1.2 and Spring WebFlux, nothing is logged and even if I configure logging.level.org.springframework.boot.autoconfigure.web.reactive.error.DefaultErrorWebExceptionHandler=debug I don't have the stacktrace, juste the exception class and the message. Same behavior with Mono.error(new RuntimeException("foo")) or when using the functional WebFlux API.

Maybe something missing in AbstractErrorWebExceptionHandler as suggested by @bclozel. I think this is a pretty serious issue.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions