Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is logging a non-blocking operation in Spring Webflux?

Tags:

Do I need to worry about logging to console, using Slf4j on top of Logback, being a blocking operation?

I wasn't sure, so I've been using reactor.logback.AsyncAppender from io.projectreactor.addons:reactor-logback:3.2.3-RELEASE

The issue I have now is that I can't compile my code using Maven as there's a transitive dependency on com.sun.java:tools:11-internal that can't be satisfied. I'm not sure how to rectify this issue, so now questioning do I even need this library.

Using Spring-boot 2.1.4-RELEASE and OpenJDK 11.0.3 with Maven 3.6.0

Maven error:

[ERROR] Failed to execute goal on project yooblr-web: Could not resolve dependencies for project com.yooblr:yooblr-web:jar:1.0.0-SNAPSHOT: Could not find artifact com.sun.java:tools:jar:11.0.3 at specified path /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home/../lib/tools.jar -> [Help 1]
like image 596
James Render Avatar asked May 08 '19 09:05

James Render


1 Answers

ch.qos.Logback.classic.AsyncAppender can be suitable in your case. It asynchronously delegates logging to regular appenders without blocking the main thread of execution.
Its pros/cons are pretty well described in the following SO thread: When not to use AsyncAppender in logback by default

like image 134
Ilya Zinkovich Avatar answered Oct 10 '22 20:10

Ilya Zinkovich