Skip to content

KLogger does not properly populate SLF4J/Logback ILoggingEvent "message" field #449

@neeme-praks-sympower

Description

@neeme-praks-sympower

Context

SLF4J/Logback ILoggingEvent (source) has two important fields / getter methods:

  • message - contains the message template (e.g. "Hello {}!")
  • formattedMessage - contains the final formatted/merged log message (e.g. "Hello world!")

This distinction is useful -- for example, we use this to aggregate log messages.

Issue

KLogger relies on Kotlin string interpolation and as a result, the message field contains the same formatted message as formattedMessage, breaking the possibilities for aggregation.

Proposal

Introduce a new field in KLoggingEventBuilder that could contain the log message template (e.g. "Hello $variable!"):

This will make it easier for me to implement something on top of KLogger to fill that field properly (I'm thinking of implementing a Kotlin compiler plugin).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions