You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by "Oleg Zhurakousky (JIRA)" <ji...@apache.org> on 2016/04/05 19:38:25 UTC

[jira] [Commented] (NIFI-1731) CapturingLogger mishandles formatted messages

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

Oleg Zhurakousky commented on NIFI-1731:
----------------------------------------

This will be fixed together with NIFI-1690 where it was discovered when writing a test to validate appropriate WARN message

> CapturingLogger mishandles formatted messages
> ---------------------------------------------
>
>                 Key: NIFI-1731
>                 URL: https://issues.apache.org/jira/browse/NIFI-1731
>             Project: Apache NiFi
>          Issue Type: Bug
>            Reporter: Oleg Zhurakousky
>            Assignee: Oleg Zhurakousky
>            Priority: Minor
>             Fix For: 0.7.0
>
>
> Here is the example of such mishandling
> {code}
> public void warn(String format, Object arg) {
>         warnMessages.add(new LogMessage(null, format, null, arg));
>         logger.warn(format, arg);
> }
> {code}
> where it really has to be 
> {code}
> public void warn(String format, Object arg) {
>         Object[] args = new Object[] { arg };
>         warnMessages.add(new LogMessage(null, MessageFormatter.arrayFormat(format, args).getMessage(), null, args));
>         logger.warn(format, arg); 
> }
> {code}
> Basically instead of _message_ we are currently passing _format_ into the 'message' field of LogMessage constructor which results in something like "{}" being the value of the message



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)