Revisit log4j2 Message.getFormat() deprecation for v9

Offen
#6,377 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
48/100
Issue-Typ
Refactoring
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
java
Bereich
backend

Rechercherichtung

Start with SentryAppender.captureLog and SentryAppender.createEvent in sentry-log4j2/src/main/java/io/sentry/log4j2/SentryAppender.java, then review the Log4j message interfaces and implementations mentioned in the issue. Determine how to preserve the unformatted template without relying on the deprecated method, and verify both the sentry.message.template attribute and event message behavior.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Next Major Platform: Java

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 getsentry/sentry-java#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.

Vorherrschende Sprache
Kotlin
Sterne
1.4k
Forks
483
Ø Merge
2 T. 2 Std.
Gemergte PRs (30 T.)
202

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus getsentry/sentry-java

Alle Issues in getsentry/sentry-java

Ähnliche Issues

Weitere Issues zu Kotlin

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.