The log()
method in Flux.class
for Project Reactor mentions that if slf4j
is available, it will be used. If you use a logger implementation like logback
with slf4j, they are by default blocking, especially the write to file/disk part. The Reactor documents don't mention anything about this. Does anyone have thoughts/experience on this?
I think one option is to maybe setup logback as async. Are there any other options? Thanks!
Asked
Active
Viewed 4,194 times
7

kriver
- 1,588
- 3
- 20
- 33
-
At any rate, Java NIO is still blocking for files. See for example [this other answer](https://stackoverflow.com/q/3955250/697630). So I don’t think that makes a difference. – Edwin Dalorzo Aug 11 '18 at 12:47
1 Answers
1
I am not sure if that is an answer to your question, but by using reactor-logback
I assumed that I am logging asynchronously.
I added the following log configuration (logback-spring.xml example)
<!-- Wrap calls to the logger. -->
<appender name="asyncFile" class="reactor.logback.AsyncAppender">
<appender-ref ref="FILE"/>
</appender>
I found this information here.

mio
- 562
- 5
- 19
-
While the mentioned solution seems to be a working approach I changed to another appender in the meantime that does asynchroneous logging, too. Namely `ch.qos.logback.classic.AsyncAppender`. – mio Jan 30 '19 at 11:13