rgoers commented on code in PR #2419:
URL: https://github.com/apache/logging-log4j2/pull/2419#discussion_r1544600596


##########
log4j-api/src/main/java/org/apache/logging/log4j/message/ParameterizedMapMessage.java:
##########
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.logging.log4j.message;
+
+import java.util.Map;
+
+/**
+ * Class Description goes here.
+ */
+public class ParameterizedMapMessage extends StringMapMessage {
+
+    private static final long serialVersionUID = -7724723101786525409L;
+    private final Message baseMessage;
+
+    ParameterizedMapMessage(Message baseMessage, Map<String, String> 
resourceMap) {
+        super(resourceMap);
+        this.baseMessage = baseMessage;
+    }
+
+    @Override
+    public String getFormattedMessage() {
+        return baseMessage.getFormattedMessage();
+    }

Review Comment:
   @ppkarwasz 
   I would suggest that Open Telemetry would be better served by adopting 
ParameterizedMapMessage than treating the message key as special. I admit, I 
have done the same thing in the past which is what motivated me to create this 
Message class as I have always found that irritating.  You are correct the 
getFormat() should be overridden but it should be baseMessage.getFormat().
   
   The purpose of ParameterizedMapMessage, as I have stated several times, is 
to have it format %m EXACTLY how ParameterizedMessage would but still have it 
be a MapMessage so other Lookups, Filters, and Layouts can extract the 
structured data from the message. That is it. No fancy tricks.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to