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

Add logback appender javaagent instrumentation #4939

Merged
merged 8 commits into from
Dec 20, 2021
Merged

Add logback appender javaagent instrumentation #4939

merged 8 commits into from
Dec 20, 2021

Conversation

trask
Copy link
Member

@trask trask commented Dec 18, 2021

Renames logback-1.0 instrumentation module to logback-mdc-1.0, and introduces logback-appender-1.0 module.

There's no autoconfiguration of log exporter (yet), so this instrumentation doesn't benefit end users unless they explicitly configure a logging exporter via javaagent extension (this is how the tests work).

@trask trask marked this pull request as ready for review December 19, 2021 06:27
Copy link
Contributor

@anuraaga anuraaga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we go ahead and add library instrumentation for logback and log4j? I guess we expect jul to be redirected to one in most cases and it's not as important there.

We already seem to be getting asked for non-javaagent logs instrumentation

open-telemetry/opentelemetry-java#3994 (comment)

@trask
Copy link
Member Author

trask commented Dec 20, 2021

Can we go ahead and add library instrumentation for logback and log4j?

We already have library instrumentation for log4j. @jack-berg mentioned last week he was working on (or thinking about writing?) a logback appender.

@trask
Copy link
Member Author

trask commented Dec 20, 2021

created #4947 to track adding a logback appender instrumentation module

trask and others added 2 commits December 19, 2021 20:35
…n/java/io/opentelemetry/javaagent/instrumentation/logback/appender/v1_0/LogbackHelper.java

Co-authored-by: Anuraag Agrawal <[email protected]>
…n/java/io/opentelemetry/javaagent/instrumentation/logback/appender/v1_0/LogbackHelper.java

Co-authored-by: Anuraag Agrawal <[email protected]>
Comment on lines +90 to +94
logger = args[0]
loggerName = args[1]
testMethod = args[2]
severity = args[3]
severityText = args[4]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would

Suggested change
logger = args[0]
loggerName = args[1]
testMethod = args[2]
severity = args[3]
severityText = args[4]
[logger, loggerName, testMethod, severity, severityText] = args

work?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

almost! it looks like def (logger, loggerName, testMethod, severity, severityText) = args should work, but not in where blocks:

where-blocks may only contain parameterizations (e.g. 'salary << [1000, 5000, 9000]; salaryk = salary / 1000')

@trask trask merged commit ea359e6 into open-telemetry:main Dec 20, 2021
@trask trask deleted the add-logback-logging-javaagent-instrumentation branch December 20, 2021 20:27
RashmiRam pushed a commit to RashmiRam/opentelemetry-auto-instr-java that referenced this pull request May 23, 2022
* logback

* Use assertInverse

* sync

* sync

* Update instrumentation/logback/logback-appender-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/logback/appender/v1_0/LogbackHelper.java

Co-authored-by: Anuraag Agrawal <[email protected]>

* Update instrumentation/logback/logback-appender-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/logback/appender/v1_0/LogbackHelper.java

Co-authored-by: Anuraag Agrawal <[email protected]>

* Unroll

Co-authored-by: Anuraag Agrawal <[email protected]>
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

Successfully merging this pull request may close these issues.

3 participants