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:37:25 UTC
[jira] [Updated] (NIFI-1731) CapturingLogger mishandles formatted
messages
[ https://issues.apache.org/jira/browse/NIFI-1731?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Oleg Zhurakousky updated NIFI-1731:
-----------------------------------
Description:
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
was:
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}
> 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)