Skip to content

Commit 75a41db

Browse files
committed
Fine tune WebFlux server logging verbosity
With this commit, WebFlux server uses warning instead of error log level for request handling, and also just print the message instead of the stacktrace which is mostly meaningless in reactive world. Complementary to this change, Reactor Netty removed additional logging as part of reactor/reactor-netty#339. Issue: SPR-16688
1 parent 5b8c6c4 commit 75a41db

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

spring-web/src/main/java/org/springframework/http/server/reactive/ReactorHttpHandlerAdapter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public Mono<Void> apply(HttpServerRequest request, HttpServerResponse response)
7373
}
7474

7575
return this.httpHandler.handle(adaptedRequest, adaptedResponse)
76-
.doOnError(ex -> logger.error("Handling completed with error", ex))
76+
.doOnError(ex -> logger.warn("Handling completed with error: " + ex.getMessage()))
7777
.doOnSuccess(aVoid -> logger.debug("Handling completed with success"));
7878
}
7979

spring-web/src/main/java/org/springframework/http/server/reactive/ServletHttpHandlerAdapter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ public void onNext(Void aVoid) {
279279

280280
@Override
281281
public void onError(Throwable ex) {
282-
logger.error("Handling completed with error", ex);
282+
logger.warn("Handling completed with error: " + ex.getMessage());
283283
runIfAsyncNotComplete(this.asyncContext, this.isCompleted, () -> {
284284
if (this.asyncContext.getResponse().isCommitted()) {
285285
logger.debug("Dispatching into container to raise error");

spring-web/src/main/java/org/springframework/http/server/reactive/UndertowHttpHandlerAdapter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public void onNext(Void aVoid) {
9797

9898
@Override
9999
public void onError(Throwable ex) {
100-
logger.error("Handling completed with error", ex);
100+
logger.warn("Handling completed with error: " + ex.getMessage());
101101
if (this.exchange.isResponseStarted()) {
102102
try {
103103
logger.debug("Closing connection");

0 commit comments

Comments
 (0)