- Notifications
You must be signed in to change notification settings - Fork 25.6k
Add JUL bridge #96683
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
Add JUL bridge #96683
Conversation
This commit adds the Log4j JUL bridge so that messages using JUL are more nicely converted to log4j messages. Currently these messages are captured via the stdout logging stream. This commit also adds a log4j filter to replace the logging stream filtering mechanism used to quiet some Lucene log messages that may be confusing to users.
| @pgomulka This is what I have so far for adding the bridge. I haven't yet finished the replacement for filtering. I'm interesting to hear your thoughts. Something I don't like about log4j filtering is that I seem to be unable to add a filter to a specific logger, so it then requires checking every message to see if it should be filtered. Is there a better way? @ChrisHegarty I tried commenting out the jvm.options vector incubator line, but I am unable to reproduce the log message you mentioned in https://github.com/elastic/elasticsearch/pull/96453/files#r1213535128. Can you clarify what is necessary to trigger those log messages? |
++
(Without any real investigation) I think we might be running into security manager issues from the jul bridge frames on the stack? This may be similar to what was discussed in #96715, which includes a recursive issue and stack overflow resulting from a bad interaction between loging and a security exception. |
Can we not simply add this to a log4j2.properties?
as per my comment #96519 (comment). I suspect those messages could be reproduced before #96453 was merged. Previously I could reproduced them as per commands in that #96519 (comment) |
I want to avoid putting there, since it would not be picked up by anyone with modifications or their own properties file (eg cloud). I think we should try to do things programmatically whenever possible. |
Also, we don't want to turn off these loggers altogether. Rather, we want to filter out these particular messages that can add confusion for users. |
agree I recon we add code along these lines in log configurate after we load configuration Perhaps similar programatic configuration we could apply for deprecation's rateLimitingFilter. Far too often I see problems where a config was not updated and that filter was not applied (it is configured in log4j2.properties). |
| Pinging @elastic/es-core-infra (Team:Core/Infra) |
| Thanks @pgomulka , I was able to build a configuration in code, and I added it to the compound configuration we already setup. I was also able to just use a regex filter instead of needing a custom filter. Also note that I did not add a filter for MMapDirectory because that warning message is no longer emitted by Lucene. |
| Also, I was able to reproduce the warning message when omitting the incubator module, so I am confident both these warning messages are being captured. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM,
great use of RegexFilter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| I suspect that thanks to a fix in #96715 we are no longer prone to security manager exceptions? |
| I haven't seen any security manager exceptions. The ones being muted here are direct Lucene messages. #96715 allowed me to reproduce the vector warning message when omitting the incubator module. |
This reverts commit 2bdf1bc.
This reverts commit 2bdf1bc.
This reverts commit bb011fb.
This commit adds the Log4j JUL bridge so that messages using JUL are more nicely converted to log4j messages. Currently these messages are captured via the stdout logging stream. This commit also adds a log4j filter to replace the logging stream filtering mechanism used to quiet some Lucene log messages that may be confusing to users.
closes #94613