Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-1161

Builder like pattern to add values to MapMessage

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.4.1
    • 2.5
    • API
    • None
    • Patch

    Description

      It would be nice to have a builder like pattern to add values to MapMessage and its subclass StructuredDataMessage, so you can do

              EventLogger.logEvent(
                  new StructuredDataMessage(confirm, null, "transfer")
                      .withValue("toAccount", toAccount)
                      .withValue("fromAccount", fromAccount)
                      .withValue("amount", amount)
              );
      

      instead of

              StructuredDataMessage msg = new StructuredDataMessage(confirm, null, "transfer");
              msg.put("toAccount", toAccount);
              msg.put("fromAccount", fromAccount);
              msg.put("amount", amount);
              EventLogger.logEvent(msg);
      

      Attachments

        Activity

          People

            mikaelstaldal Mikael Ståldal
            mikaelstaldal Mikael Ståldal
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: