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

Log4jEventBuilder does not support dynamic fqcn so incompatible with slf4j #1533

Closed
oshai opened this issue Jul 3, 2023 · 6 comments · Fixed by #1534
Closed

Log4jEventBuilder does not support dynamic fqcn so incompatible with slf4j #1533

oshai opened this issue Jul 3, 2023 · 6 comments · Fixed by #1534

Comments

@oshai
Copy link
Contributor

oshai commented Jul 3, 2023

Description

In order to allow changing the fqcn (and support other wrapping frameworks like slf4j kotlin-logging) in fluent api that logs line numbers, should make Log4jEventBuilder implement CallerBoundaryAware.

Configuration

Version: 2.20

Logs

LoggingWithLocationTest[jvm] > testNullLoggingWithLocationEntryExitOpt()[jvm] FAILED
    org.opentest4j.AssertionFailedError: expected: <TRACE ClassWithLoggingForLocationTesting.logExitOpt(26) - entry with (1, 2)
    INFO ClassWithLoggingForLocationTesting.logExitOpt(27) - log entry body
    TRACE ClassWithLoggingForLocationTesting.logExitOpt(28) - exit with (null)> but was: <TRACE ClassWithLoggingForLocationTesting.logExitOpt(26) - entry with (1, 2)
    INFO LocationAwareKLogger.at(46) - log entry body

Reproduction

See reproduction here: oshai/kotlin-logging@92378ee

The code switches to fluent api, and the unit test in github actions fails. For example: LoggingWithLocationTest.testNullLoggingWithLocationEntryExitOpt() with the output above.

I can add a fix if you'd like.

@ppkarwasz
Copy link
Contributor

@oshai,

Thanks for the report. If you submit a PR, we should be able to include it in the next release. The Log4j's equivalent of SLF4J's CallerBoundaryAware is BridgeAware and our logger builder implements it.

oshai added a commit to oshai/logging-log4j2 that referenced this issue Jul 3, 2023
@oshai
Copy link
Contributor Author

oshai commented Jul 3, 2023

I created a fix here: #1534

Let me know if my intention is clear.

ppkarwasz pushed a commit to oshai/logging-log4j2 that referenced this issue Jul 10, 2023
ppkarwasz pushed a commit that referenced this issue Jul 11, 2023
ppkarwasz pushed a commit that referenced this issue Jul 11, 2023
@ppkarwasz
Copy link
Contributor

@oshai, thank You for your contribution.

@oshai
Copy link
Contributor Author

oshai commented Jul 11, 2023

@ppkarwasz Thanks!

Do you know which / when a new version will be released with the fix?

@ppkarwasz
Copy link
Contributor

@oshai,

We try to release quarterly, so version 2.20.1 is already overdue. However everything depends on our daily jobs, since the release process requires a lot of time.

@oshai
Copy link
Contributor Author

oshai commented Jul 11, 2023

Thanks!

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 a pull request may close this issue.

2 participants