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 the default behavior since the very beginning of slf4j, including the latest slf4j-api:2.0.9:
When there's no provider available, slf4j prints an error message to stderr when the library is used for the first time and swallows all logging messages.
SLF4J: No SLF4J providers were found.
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See https://www.slf4j.org/codes.html#noProviders for further details.
Can we just log to stdout instead of swallowing the messages?
I know there's a slf4j-simple but it would be much easier to "combine" slf4j-api and slf4j-simple, or just log to stdout/stderr.
The graal native-image gives us an opportunity to build fast command line tools, which will use some existing java libraries. Since slf4j is widely used, a lot of libraries uses slf4j as their logging dependency.
However this requires us to include slf4j-simple for the projects which depend on these libraries.
This is ok for projects running on the server side since it would always need a logging impl anyway, but it's quite redundant for the command-line tools, and it would require extra configurations when building the native-image (we must ensure slf4j-simple accessible and can be used via reflection when building).
So can we consider to simply log to stdout when there is no provider available?
The text was updated successfully, but these errors were encountered:
wkgcass
changed the title
Can we log the message to stdout when there is not provider available?
Can we log the message to stdout when there is no provider available?
Nov 29, 2023
This is the default behavior since the very beginning of
slf4j
, including the latestslf4j-api:2.0.9
:When there's no provider available, slf4j prints an error message to stderr when the library is used for the first time and swallows all logging messages.
Can we just log to stdout instead of swallowing the messages?
I know there's a
slf4j-simple
but it would be much easier to "combine"slf4j-api
andslf4j-simple
, or just log to stdout/stderr.The graal
native-image
gives us an opportunity to build fast command line tools, which will use some existing java libraries. Sinceslf4j
is widely used, a lot of libraries uses slf4j as their logging dependency.However this requires us to include
slf4j-simple
for the projects which depend on these libraries.This is ok for projects running on the server side since it would always need a logging impl anyway, but it's quite redundant for the command-line tools, and it would require extra configurations when building the native-image (we must ensure
slf4j-simple
accessible and can be used via reflection when building).So can we consider to simply log to stdout when there is no provider available?
The text was updated successfully, but these errors were encountered: