ppkarwasz commented on code in PR #2419: URL: https://github.com/apache/logging-log4j2/pull/2419#discussion_r1544820856
########## 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: > I would suggest that Open Telemetry would be better served by adopting `ParameterizedMapMessage` than treating the message key as special. Due to a "happens before" relationship they didn't have the chance to do it. :grin: > 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. Sure, extending `MapMessage` is a nice trick to maintain some sort of backward compatibility. However I would like to have a well documented Java interface that `ParameterizedMapMessage` will implement. In time we can switch all the `instanceof MapMessage` to that class. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
