-
Notifications
You must be signed in to change notification settings - Fork 859
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
Avoid unecessary addition of the Logback appender #11610
base: main
Are you sure you want to change the base?
Conversation
|
@zeitlinger could you take a look |
looks like it was working as intended - |
If the global swith is not provided and you provide |
As soon as |
got it - reopening |
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.
thanks for the contribution.
please add a test to
Line 97 in 80e5bac
void shouldNotInitializeAppenderWhenDisabled() { |
...y/instrumentation/spring/autoconfigure/instrumentation/logging/LogbackAppenderInstaller.java
Outdated
Show resolved
Hide resolved
...y/instrumentation/spring/autoconfigure/instrumentation/logging/LogbackAppenderInstaller.java
Outdated
Show resolved
Hide resolved
hi @jfbreault! are you able to sign the CLA above? #11610 (comment) |
simply implementation add test
Cla signed, test added, everything see to work. Btw, the autoconfiguration seems weird and the spring.factories will be loaded even if |
I think this was the best solution we could find. cc @jeanbisutti |
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.
The new tests seem unrelated to the code update.
The modified code is for the automatic addition of the Logback appender if the user has not declared the OpenTelemetry Logback appender in a Logback XML file. The new tests use a Logback XML file.
If the global swith is not provided and you provide otel.instrumentation.logback-appender.enabled=false the appender is currently registered
Even it's the case, the appender won't produce log records See
Line 35 in de11929
@ConditionalOnEnabledInstrumentation(module = "logback-appender") |
I am off this week. I could have another look the week after.
@jfbreault If there is a regression, could please provide a test reproducing the regression or explain how to reproduce it? |
@jeanbisutti It's not a regression, it's somthing I found when debugging my issue, it's should be an other issue/pr if we want to fix it. I just wanted to higlight it |
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.
See #11610 (review)
The regression is adding the support of the global flag The other issue that I was highlighting is the autoconfiguration registering an event listener to add the appender is probably unnecessary as the listener is already registered in spring.factories so it try to register it a second time, the Anyway, with this pr, we can disable the registration with the standard otel flag |
In this case, OpenTelemetry won't be installed into the OpenTelemetry Logback appender, and the appender won't emit log records. So, from a user perspective, the OpenTelemetry Logback appender is disabled. If The tests you have added in I have also suggested two changes about the naming. If you want to add a test with PRs and issues are welcome if you think that something is not working as expected or if you want to add more tests. |
Hello @jeanbisutti @zeitlinger and @jfbreault, what's the status on this? I agree with @jfbreault on the way he did implement it and this is fixing also some of my issue. Thanks! |
@jfbreault We could merge the PR with the few changes asked above. |
@piclemx If you observe an issue, could you please provide the steps to reproduce it? We need to be able to reproduce the problem to be able to fix it. |
No description provided.