title: Proper logging in reactive application - WebFlux
body: <p>last time I am thinking about proper using logger in our applications.
  For example, I have a controller which returns a stream of users but in the log, I see the &quot;Fetch Users&quot; log is being logged by another thread than the thread on the processing pipeline but is it a good approach?</p>
  <pre><code>@Slf4j
  class AwesomeController {
      
      @GetMapping(path = &quot;/users&quot;)
      public Flux&lt;User&gt; getUsers() {
          log.info(&quot;Fetch users..&quot;);
          
          return Flux.just(...)..subscribeOn(Schedulers.newParallel(&quot;my-custom&quot;));
      
      }
  }
  </code></pre>
  <p>In this case, two threads are used and from my perspective, not a good option, but I can't find good practices with loggers in reactive applications. I think below approach is better because allocation memory is from processing thread but not from spring webflux thread which potential can be blocking but logger.</p>
  <pre><code>   @GetMapping(path = &quot;/users&quot;)
      public Flux&lt;User&gt; getUsers() {
  
          return Flux.defer(() -&gt; {
              return Mono.fromCallable(() -&gt; {
                  log.info(&quot;Fetch users..&quot;);
                      .....
              })
          }).subscribeOn(Schedulers.newParallel(&quot;my-custom&quot;))
      }
  </code></pre>