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

Make warning about JUL mutator usage less verbose #3281

Open
ppkarwasz opened this issue Dec 4, 2024 · 0 comments
Open

Make warning about JUL mutator usage less verbose #3281

ppkarwasz opened this issue Dec 4, 2024 · 0 comments

Comments

@ppkarwasz
Copy link
Contributor

PR #3125 adds status logger warnings, each time user code calls one of the mutator methods of j.u.l.Logger:

2024-12-04T11:13:21.273591100Z VelocityControl - Task Executor #0 WARN Ignoring call to `j.u.l.Logger.setLevel(OFF)`, since the Log4j API does not provide methods to modify the underlying implementation.
To modify the configuration using JUL, use an `AbstractLoggerAdapter` appropriate for your logging implementation.
See https://logging.apache.org/log4j/3.x/log4j-jul.html#log4j.jul.loggerAdapter for more information.
2024-12-04T11:13:21.274590Z VelocityControl - Task Executor #0 WARN Ignoring call to `j.u.l.Logger.setLevel(false)`, since the Log4j API does not provide methods to modify the underlying implementation.
To modify the configuration using JUL, use an `AbstractLoggerAdapter` appropriate for your logging implementation.
See https://logging.apache.org/log4j/3.x/log4j-jul.html#log4j.jul.loggerAdapter for more information.
2024-12-04T11:13:21.276589400Z VelocityControl - Task Executor #0 WARN Ignoring call to `j.u.l.Logger.addHandler(java.util.logging.ConsoleHandler@5ce92a4a)`, since the Log4j API does not provide methods to modify the underlying implementation.
To modify the configuration using JUL, use an `AbstractLoggerAdapter` appropriate for your logging implementation.
See https://logging.apache.org/log4j/3.x/log4j-jul.html#log4j.jul.loggerAdapter for more information.

While I believe that these warnings are important to inform the application developer that something is trying to mess with the logging configuration, they might be too verbose for application users. We should probably adopt a similar strategy as Java with the illegal reflective calls:

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by io.netty.util.internal.ReflectionUtil (file:/home/azureuser/server-0.28.0-SNAPSHOT.jar) to constructor java.nio.DirectByteBuffer(long,int)
WARNING: Please consider reporting this to the maintainers of io.netty.util.internal.ReflectionUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

In particular:

  • The warning should mention the caller of the method.
  • The warning should suggest reporting the problem to the maintainer of the caller class.
  • There should be a Log4j option to decide how many times the warning should appear, e.g. log4j2.julMutatorAccess with values warn-once (default), ignore and warn.
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

1 participant