ppkarwasz commented on issue #3473:
URL: 
https://github.com/apache/logging-log4j2/issues/3473#issuecomment-2700757659

   > The problem here is that just because a throwable occurs as the last 
parameter does not necessarily mean it will be logged as a throwable. That 
depends on what the chosen layout chooses to do.
   
   It does not depend on the layout, since this is usually handled in 
`AbstractLogger`:
   
   
https://github.com/apache/logging-log4j2/blob/23290e480d7c9146af962d1a3707ab7b06648894/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java#L2630-L2640
   
   The reported issue comes from the fact that the `logMessage` method with an 
additional `StackTraceElement` does not apply the same logic:
   
   
https://github.com/apache/logging-log4j2/blob/23290e480d7c9146af962d1a3707ab7b06648894/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java#L2847-L2863
   
   The behavior is rather inconsistent: sometimes methods that accept `Message` 
also use it to produce a `Throwable` and sometimes they don't. In `3.0.0-beta3` 
the behavior should be consistent: if `throwable` is `null`, 
`Message.getThrowable()` is called.


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