Feature to allow suppressing unsuccessful init error message #157
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As you can read in m-m-m/util#194 there are cases where one uses slf4j in general library code that is also used in command-line-interface (CLI) programs.
In my case I want to ship the CLI library without any logger binding for slf4j in order to give users the freedom to choose on their own. However the CLI library already contains CLI programs by itself. If you want to run them without additional dependencies you get a warm welcome from slf4j saying:
In case of a CLI program this output is really undesired.
I tried to be constructive and provide a minimal invasive "fix" for the problem that allows to suppress this output by setting a system property
slf4j.suppressInitError
(I tried to follow your current code and naming conventions) to true.You can also add a public static non-arg method to
LoggerFactory
that sets the system property to true for you if you like. Also you can think of a system property that enforces nop logger no matter what is on your classpath. But as stated before I wanted to keep the change and impact minimal so I hopefully have a high change to get this PR accepted and you see this as a helpful improvement to slf4j. Thanks in advance.