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

Re-enable logging of SLF4J on tests to make automated test more useful #1587

Closed
stephanr opened this issue Oct 19, 2023 · 1 comment · Fixed by #1631
Closed

Re-enable logging of SLF4J on tests to make automated test more useful #1587

stephanr opened this issue Oct 19, 2023 · 1 comment · Fixed by #1631
Labels
dependencies Pull requests that update a dependency (library) enhancement enhancement or improvement needs discussion requires discussion with contributor

Comments

@stephanr
Copy link
Member

stephanr commented Oct 19, 2023

At the TMC meeting on 2023-10-18 we talked about the logging output on test via SLF4J is currently disabled for most modules.

This results in messages like:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

As a result failing tests are, when they are using SLF4J, be hard to interpret as the logging is missing.

The participants of the meeting came to the conclusion that logging should be re-enabled without polluting the log file.

The following goals were noted:

  • Re-enable logging on test
  • Keep configuration overhead minimal
  • It would be nice if this can be done on a base module which is then (automatically) picked up by all test without modifying each one separately
  • The solution should have less or no new dependencies
  • By default a threshold should be active to prevent log file pollution
    • for example only let WARN and ERROR messages pass by default
@stephanr stephanr added enhancement enhancement or improvement needs discussion requires discussion with contributor dependencies Pull requests that update a dependency (library) labels Oct 19, 2023
@stephanr
Copy link
Member Author

A possible solution could be to use SLF4J simple log as we are currently using SLF4J as a base for logging and this would automatically be updated along without extra dependency or configuration files.

Configuration of a threshold is possible with a system parameter of org.slf4j.simpleLogger.defaultLogLevel=warn.

      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-simple</artifactId>
        <scope>test</scope>
      </dependency>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency (library) enhancement enhancement or improvement needs discussion requires discussion with contributor
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant