Skip to content

EventLookup throws NullPointerException for ${event:Message} when the event has no message #4502

Open

Description

@ramanathan1504

EventLookup.lookup returns event.getMessage().getFormattedMessage() for the Message key without a null check (EventLookup.java:68). Log4jLogEvent accepts a null message, so ${event:Message} throws NullPointerException for such an event. The Marker key already checks for null (EventLookup.java:41).

StrSubstitutor catches it, so the expression stays literal, but every evaluation logs "Resolver failed to lookup event:Message" to the status logger.

Fix: return null when event.getMessage() is null.

Activity

  1. added
    bug
    lookups
    on Nov 19, 2026
  2. added this to the 2.27.0 milestone on Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buglookups

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions