-
Notifications
You must be signed in to change notification settings - Fork 893
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
log4j2-Appender-like ability to filter log4j2 log events #6967
Comments
Of course now I notice OpenTelemetryAppender... So that's there. And if one allows the auto-configuration to do its thing then all log4j logging not filtered out by level at the logger level by the log4j configuration is exported. So I belated discovered |
hi @JessHolle!
this is surprising, the auto-instrumentation is applied after the application's logger level is checked, so it should not be capturing logs without any regard to the target logger or level, can you post a repro that we can look into to see why this might be happening for you? |
check out discussion in #5464 |
As per my later comment, I belatedly tested and re-examined the code -- and discovered that the instrumentation is after logger level filtering takes place. It still doesn't give the flexibility of an Appender, though. For instance, we have a system where a fair amount of logging is done to a database -- of the same sort of material that would be covered by traces. So while the auto-instrumentation is a good first pass, documentation for disabling that and applying the OpenTelemetryAppender where more control is needed would be great. |
Thanks, I added a comment/query there -- as giving an ability to auto-instrument with minimal configuration sounds more attractive than manually configuring to use OpenTelemetryAppender. |
closing in favor of #5464 |
Unless I am missing something the current instrumentation will catch all attempts to log to a log4j2 logger -- without any regard to the target logger and/or log event severity level.
This may well result in overwhelming verbosity. It would seem that filtering control is really needed on at least combinations of these 2 dimensions (logger name and severity level).
A seemingly attractive alternative to inventing another filtering configuration would be actually use a log4j Appender -- thus allowing "normal" filtering in this space. This might entail disabling this portion of the auto instrumentation and configuring a log4j2 Appender that behaves like the current instrumentation. Or it might involve the auto-instrumentation actually creating a NullAppender with a special (configurable) name and attaching it to the root logger if it does not already exist (but re-using an existing one and its configuration otherwise) and then instrumenting calls to that Appender.
The text was updated successfully, but these errors were encountered: