Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can we log the message to stdout when there is no provider available? #369

Open
wkgcass opened this issue Nov 29, 2023 · 1 comment
Open

Comments

@wkgcass
Copy link

wkgcass commented Nov 29, 2023

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?

@wkgcass 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
@ceki
Copy link
Member

ceki commented Dec 1, 2023

In response to issue 361 the Reporter class has been added. See commit 316b5d1 and commit c12667b

The Reporter class will be part of the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants