Skip to content

Convert all logging statements from slf4j to jul - #5674

Merged
trask merged 4 commits into
open-telemetry:mainfrom
mateuszrzeszutek:jul-2
Mar 25, 2022
Merged

Convert all logging statements from slf4j to jul#5674
trask merged 4 commits into
open-telemetry:mainfrom
mateuszrzeszutek:jul-2

Conversation

@mateuszrzeszutek

Copy link
Copy Markdown
Member

Closes #5077

@mateuszrzeszutek
mateuszrzeszutek requested a review from a team March 23, 2022 16:17

@trask trask left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍

@mateuszrzeszutek

Copy link
Copy Markdown
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)


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

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
@mateuszrzeszutek
mateuszrzeszutek deleted the jul-2 branch November 18, 2022 10:28
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