[
https://issues.apache.org/jira/browse/NIFI-13265?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17849800#comment-17849800
]
Daniel Stieglitz edited comment on NIFI-13265 at 5/27/24 6:18 PM:
------------------------------------------------------------------
[~exceptionfactory] The basic fix for this ticket is to remove the
instantiation of an Object[] for a log statement's arguments which by in large
I have taken care of. There are though some log statements which I saw which
seem be superfluous. The prime cases I saw where this a parameter for an
exception object and in some cases there is a parameter for an exception's
message and the last parameter is an exception. Please correct me if I am wrong
but I thought the SimpleProcessLogger can detect when the last parameter is a
Throwable and it emits a message which includes the Throwable's message and a
shorter stacktrace. Hence is it necessary to have parameters for the exception
or the exception's message? I didn't think so so in some cases I reworded the
log message e.g.
For file
nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-hadoop-record-utils/src/main/java/org/apache/nifi/processors/hadoop/AbstractFetchHDFSRecord.java
line 245 the original code is
{code:java}
getLogger().error("Failed to retrieve content from {} for {} due to {}; routing
to failure", new Object[] {filenameValue, originalFlowFile, e});
{code}
and I changed it to
{code:java}
getLogger().error("Routing to failure since failed to retrieve content from {}
for {} due to ", filenameValue, originalFlowFile, e);
{code}
Is that okay?
was (Author: JIRAUSER294662):
[~exceptionfactory] The basic fix for this ticket is to remove the
instantiation of an Object[] for a log statement's arguments which by in large
I have taken care of. There are though some log statements which I saw which
seem be superfluous. The prime cases I saw where this a parameter for an
exception object and in some cases there is a parameter for an exception's
message and the last parameter is an exception. Please correct me if I am wrong
but I thought the SimpleProcessLogger can detect when the last parameter is a
Throwable and it emits a message which includes the Throwable's message and a
shorter stacktrace. Hence is it necessary to have parameters for the exception
or the exception's message? I didn't think so so in some cases I reworded the
log message e.g.
nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-hadoop-record-utils/src/main/java/org/apache/nifi/processors/hadoop/AbstractFetchHDFSRecord.java
line 245
{code:java}
getLogger().error("Failed to retrieve content from {} for {} due to {}; routing
to failure", new Object[] {filenameValue, originalFlowFile, e});
{code}
to
{code:java}
getLogger().error("Routing to failure since failed to retrieve content from {}
for {} due to ", filenameValue, originalFlowFile, e);
{code}
Is that okay?
> Remove the instantiation of Object arrays for arguments in ComponentLog log
> and org.slf4j.Logger statements
> -----------------------------------------------------------------------------------------------------------
>
> Key: NIFI-13265
> URL: https://issues.apache.org/jira/browse/NIFI-13265
> Project: Apache NiFi
> Issue Type: Improvement
> Reporter: Daniel Stieglitz
> Assignee: Daniel Stieglitz
> Priority: Minor
>
> There are still classes after the changes in NIFI-12075 and NIFI-12076 which
> instantiate an Object array for ComponentLog log statements. This ticket aims
> to remove those instantiations. In addition similar changes should be made to
> org.slf4j.Logger statements.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)