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

Convert all logging statements from slf4j to jul #5674

Merged
merged 4 commits into from
Mar 25, 2022

Conversation

mateuszrzeszutek
Copy link
Member

Closes #5077

@mateuszrzeszutek mateuszrzeszutek requested a review from a team as a code owner March 23, 2022 16:17
Copy link
Member

@trask trask left a comment

Choose a reason for hiding this comment

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

I found reviewing a bit confusing in places where TransformSafeLogger is used since that api is now different from normal loggers, maybe worth sync'ing up that class.

Comment on lines -44 to +39
// org.slf4j.LoggerFactory.getLogger((Class)ExceptionLogger.class)
// .debug("exception in instrumentation", t);
// ExceptionLogger.logSuppressedError("exception in instrumentation", t);
Copy link
Member

Choose a reason for hiding this comment

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

👍

@mateuszrzeszutek
Copy link
Member Author

I found reviewing a bit confusing in places where TransformSafeLogger is used since that api is now different from normal loggers, maybe worth sync'ing up that class.

I simplified the API so that it looks the same as Logger, with one exception:

public void log(Level level, String message, Object[] args, Throwable error)

The original Logger could not accept both params and error, but that looked terrible, so I decided to introduce this method (it looks like one of the Logger methods, so I guess it should be fine)

@@ -64,6 +63,21 @@ dependencies {
testImplementation("com.google.guava:guava")
}

testing {
suites {
val testExceptionHandler by registering(JvmTestSuite::class) {
Copy link
Member

Choose a reason for hiding this comment

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

does this target specific tests?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, just the ExceptionHandlerTest - I moved it to a separate source directory, along with all its dependencies. I found that when I run ./gradlew :javaagent-tooling:check locally it was randomly failing on that test; probably because it interfered with other bytecode modifying tests in the test source root.

Copy link
Member

Choose a reason for hiding this comment

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

oh yes, I missed that this is tied to directory name, thx!

@trask trask merged commit b668e73 into open-telemetry:main Mar 25, 2022
RashmiRam pushed a commit to RashmiRam/opentelemetry-auto-instr-java that referenced this pull request May 23, 2022
* Convert all logging statements from slf4j to jul

* code review comments

* fix tests

* Fix randomly failing test
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.

Convert all logging statements from slf4j to jul
3 participants