[ 
https://issues.apache.org/jira/browse/LOG4J2-2863?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17598413#comment-17598413
 ] 

Marian Barton commented on LOG4J2-2863:
---------------------------------------

I think I ran into the same issue and created another ticket with more details. 
It's linked.

[~rgoers] [~npepinpe] 

> LocationAwareLogger implementation fails to extract throwable from message
> --------------------------------------------------------------------------
>
>                 Key: LOG4J2-2863
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2863
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: SLF4J Bridge
>    Affects Versions: 2.13.3
>            Reporter: Nicolas Pepin-Perreault
>            Priority: Minor
>
> (Note: I looked but didn't see any issues for this - though I had a hard time 
> coming up with a quick summary, so maybe I didn't search for the right 
> things, sorry in advance if this is a duplicate)
>  
> When using the SLF4J bridge's Log4JLogger class as a LocationAwareLogger, if 
> no throwable is given but the ParametrizedMessage contains one, it seems it 
> is not properly extracted.
>  
> One thing I saw, is at 
> [org.apache.logging.slf4j.Log4JLogger:372|https://github.com/apache/logging-log4j2/blob/7e745b42bda9bf6f8ea681d38992d18036fc021e/log4j-slf4j-impl/src/main/java/org/apache/logging/slf4j/Log4jLogger.java#L372],
>  it seems there's a check if we're already passing a throwable, and we only 
> pick up the one from the message if we already are. Is this intentional, and 
> if so, what's the reasoning? From looking at ParametrizedMessage, it seems 
> the throwable is picked up from the message arguments iff there was no 
> throwable initially given, but maybe I misunderstood this.
>  
> The use case here is that we have a delegating logger class, but we want the 
> location to be properly computed, so we need to access the logger as a 
> LocationAwareLogger.
>  
> Cheers,



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to