You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@uima.apache.org by "Richard Eckart de Castilho (JIRA)" <de...@uima.apache.org> on 2017/09/15 07:50:00 UTC

[jira] [Commented] (UIMA-5571) uv3 log4j bridge not handling multi-substitutable args vs throwable correctly

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

Richard Eckart de Castilho commented on UIMA-5571:
--------------------------------------------------

SLF4J automatically detects if the last var-arg argument in a logging statement is a Throwable and handles that case to print a stack trace. Does UIMA do that as well?

{noformat}
log("{0} failed: {1}", action, e.getMessage(), e);
{noformat}


> uv3 log4j bridge not handling multi-substitutable args vs throwable correctly
> -----------------------------------------------------------------------------
>
>                 Key: UIMA-5571
>                 URL: https://issues.apache.org/jira/browse/UIMA-5571
>             Project: UIMA
>          Issue Type: Bug
>          Components: Core Java Framework
>    Affects Versions: 3.0.0SDK-alpha02
>            Reporter: Marshall Schor
>             Fix For: 3.0.0SDK-beta
>
>
> The log4j (v2) API has calls which allow both a message (with substitutable parts) and arguments to substitute.
> It also has calls which allow passing a throwable.
> The calls that support passing a throwable do not support substituable parts.  The bridge code assumed that it did.  This resulted in an array of args being treated as one substitutable value. 
>  
> Change the bridge code to call one of two different log4j methods, depending on whether or not a throwable is being included.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Re: [jira] [Commented] (UIMA-5571) uv3 log4j bridge not handling multi-substitutable args vs throwable correctly

Posted by Marshall Schor <ms...@schor.com>.
I don't think it does.   The fix might be somewhat complex, because several
back-ends (log4j and java-util-logging) don't support message argument
substitution when a throwable is being used.

I'll have to see if I can figure out a suitable fix...

Thanks. -Marshall


On 9/15/2017 3:50 AM, Richard Eckart de Castilho (JIRA) wrote:
>     [ https://issues.apache.org/jira/browse/UIMA-5571?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16167479#comment-16167479 ] 
>
> Richard Eckart de Castilho commented on UIMA-5571:
> --------------------------------------------------
>
> SLF4J automatically detects if the last var-arg argument in a logging statement is a Throwable and handles that case to print a stack trace. Does UIMA do that as well?
>
> {noformat}
> log("{0} failed: {1}", action, e.getMessage(), e);
> {noformat}
>
>
>> uv3 log4j bridge not handling multi-substitutable args vs throwable correctly
>> -----------------------------------------------------------------------------
>>
>>                 Key: UIMA-5571
>>                 URL: https://issues.apache.org/jira/browse/UIMA-5571
>>             Project: UIMA
>>          Issue Type: Bug
>>          Components: Core Java Framework
>>    Affects Versions: 3.0.0SDK-alpha02
>>            Reporter: Marshall Schor
>>             Fix For: 3.0.0SDK-beta
>>
>>
>> The log4j (v2) API has calls which allow both a message (with substitutable parts) and arguments to substitute.
>> It also has calls which allow passing a throwable.
>> The calls that support passing a throwable do not support substituable parts.  The bridge code assumed that it did.  This resulted in an array of args being treated as one substitutable value. 
>>  
>> Change the bridge code to call one of two different log4j methods, depending on whether or not a throwable is being included.
>
>
> --
> This message was sent by Atlassian JIRA
> (v6.4.14#64029)
>