Skip to content

Revisit log4j2 Message.getFormat() deprecation for v9 #6377

Open

Description

@runningcode

Log4j 2.24.0 deprecated org.apache.logging.log4j.message.Message.getFormat(), and sentry-log4j2 still calls it to get the unformatted message template. The deprecation warning is suppressed in #5435 (log4j2 2.20.0 → 2.26.1) to keep the build passing under -Xlint:all -Werror.

  • Call sites: SentryAppender.captureLog (populates the sentry.message.template log attribute) and SentryAppender.createEvent (sets Message.message on events) in sentry-log4j2/src/main/java/io/sentry/log4j2/SentryAppender.java.
  • The deprecation note points to MultiformatMessage for implementing messages. It does not offer a replacement for reading a message's template, and getFormattedMessage() drops the template.
  • In 2.26.1 the interface method is a default that returns null. Concrete classes such as ParameterizedMessage, ReusableParameterizedMessage, StringFormattedMessage, MessageFormatMessage and SimpleMessage still override it without a deprecation.
  • Log4j 3 has only reached 3.0.0-beta3; no stable 3.0 is listed in the Apache release catalog.

Proposed by Nelson Osacky: suppress the warning now and revisit the call in the next major.

Action taken on behalf of Nelson Osacky.

Activity

  1. linear-code commented on Oct 26, 2026

    @linear-code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions