You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is less-than-ideal for us, since one of the first things we do in our main is do some housekeeping and SLF4J logger configuration. But because Reactor creates a logger factory statically and then logs a message to it here:
This forces SLF4J to initialize, and our logging implementation of choice (in our case Logback) to initialize before we've had a chance to configure it how we want to from within main. Reactor should not initialize and then immediately use an SLF4J logger statically.
Motivation
It seems unusual for Reactor to attempt to initialize so much statically. I have not yet run into any other library in the past near-decade since we've been using this method of configuring our logger that attempted to log statically. This is the first and only library that I've attempted to use that was not compatible with our method of configuring loggers.
Desired solution
It seems like other classes such as Hooks in my testing also run statically before main and emit logs, so I am not entirely sure what would have to change. But ideally, logging would be initialized lazily, and no logs should be attempted to be emitted until a Reactor class is actually used at normal runtime.
Considered alternatives
We could rewrite our stack to only use default logger paths and classes such that our logger is able to be initialized in the way we want it to before main gets to run, but this could be quite a bit of work to change for us.
Additional context
The text was updated successfully, but these errors were encountered:
Reactor initializes SLF4J logging to be initialized statically before a program's
main
method runs due to this static block:reactor-core/reactor-core/src/main/java/reactor/util/Loggers.java
Lines 55 to 57 in 7259f57
This is less-than-ideal for us, since one of the first things we do in our
main
is do some housekeeping and SLF4J logger configuration. But because Reactor creates a logger factory statically and then logs a message to it here:reactor-core/reactor-core/src/main/java/reactor/util/Loggers.java
Line 176 in 7259f57
This forces SLF4J to initialize, and our logging implementation of choice (in our case Logback) to initialize before we've had a chance to configure it how we want to from within
main
. Reactor should not initialize and then immediately use an SLF4J logger statically.Motivation
It seems unusual for Reactor to attempt to initialize so much statically. I have not yet run into any other library in the past near-decade since we've been using this method of configuring our logger that attempted to log statically. This is the first and only library that I've attempted to use that was not compatible with our method of configuring loggers.
Desired solution
It seems like other classes such as
Hooks
in my testing also run statically beforemain
and emit logs, so I am not entirely sure what would have to change. But ideally, logging would be initialized lazily, and no logs should be attempted to be emitted until a Reactor class is actually used at normal runtime.Considered alternatives
We could rewrite our stack to only use default logger paths and classes such that our logger is able to be initialized in the way we want it to before
main
gets to run, but this could be quite a bit of work to change for us.Additional context
The text was updated successfully, but these errors were encountered: