Skip to content

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

Closed
@oshai

Description

@oshai

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions