ppkarwasz commented on a change in pull request #767:
URL: https://github.com/apache/logging-log4j2/pull/767#discussion_r811231397



##########
File path: log4j-1.2-api/src/main/java/org/apache/log4j/Category.java
##########
@@ -309,15 +309,10 @@ private void fireRemoveAppenderEvent(final Appender 
appender) {
 
     public void forcedLog(final String fqcn, final Priority level, final 
Object message, final Throwable t) {
         final org.apache.logging.log4j.Level lvl = 
org.apache.logging.log4j.Level.toLevel(level.toString());
+        final Message msg = LegacyMessageFactory.INSTANCE.newMessage(message);
         if (logger instanceof ExtendedLogger) {
-            @SuppressWarnings("unchecked")
-            final Message msg = message instanceof Message ? (Message) message
-                : message instanceof Map ? new MapMessage((Map) message) : new 
ObjectMessage(message);
             ((ExtendedLogger) logger).logMessage(fqcn, lvl, null, msg, t);
         } else {
-            final ObjectRenderer renderer = get(message.getClass());
-            final Message msg = message instanceof Message ? (Message) message
-                : renderer != null ? new RenderedMessage(renderer, message) : 
new ObjectMessage(message);

Review comment:
       The `RenderedMessage` case is omitted, since this would require a 
stateful `MessageFactory` (per category).
   
   Anyway there is currently no way to add elements to the `RendererMap`.




-- 
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