nifi-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (NIFI-4277) StandardLogRepository does not log exceptions
Date Wed, 09 Aug 2017 09:52:00 GMT

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

ASF GitHub Bot commented on NIFI-4277:
--------------------------------------

GitHub user pvillard31 opened a pull request:

    https://github.com/apache/nifi/pull/2068

    NIFI-4277 Fixed exception logging in StandardLogRepository

    Thank you for submitting a contribution to Apache NiFi.
    
    In order to streamline the review of the contribution we ask you
    to ensure the following steps have been taken:
    
    ### For all changes:
    - [ ] Is there a JIRA ticket associated with this PR? Is it referenced 
         in the commit message?
    
    - [ ] Does your PR title start with NIFI-XXXX where XXXX is the JIRA number you are trying
to resolve? Pay particular attention to the hyphen "-" character.
    
    - [ ] Has your PR been rebased against the latest commit within the target branch (typically
master)?
    
    - [ ] Is your initial contribution a single, squashed commit?
    
    ### For code changes:
    - [ ] Have you ensured that the full suite of tests is executed via mvn -Pcontrib-check
clean install at the root nifi folder?
    - [ ] Have you written or updated unit tests to verify your changes?
    - [ ] If adding new dependencies to the code, are these dependencies licensed in a way
that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)?

    - [ ] If applicable, have you updated the LICENSE file, including the main LICENSE file
under nifi-assembly?
    - [ ] If applicable, have you updated the NOTICE file, including the main NOTICE file
found under nifi-assembly?
    - [ ] If adding new Properties, have you added .displayName in addition to .name (programmatic
access) for each of the new properties?
    
    ### For documentation related changes:
    - [ ] Have you ensured that format looks appropriate for the output in which it is rendered?
    
    ### Note:
    Please ensure that once the PR is submitted, you check travis-ci for build issues and
submit an update to your PR as soon as possible.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/pvillard31/nifi NIFI-4277

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/nifi/pull/2068.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #2068
    
----
commit 7e91f4ed597d337e0e8b882d89b9d92a8a316df8
Author: Pierre Villard <pierre.villard.fr@gmail.com>
Date:   2017-08-09T09:50:53Z

    NIFI-4277 Fixed exception logging in StandardLogRepository

----


> StandardLogRepository does not log exceptions
> ---------------------------------------------
>
>                 Key: NIFI-4277
>                 URL: https://issues.apache.org/jira/browse/NIFI-4277
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Core Framework
>    Affects Versions: 1.3.0
>            Reporter: Pierre Villard
>            Assignee: Pierre Villard
>         Attachments: Screen Shot 2017-08-08 at 2.48.33 PM.png
>
>
> When logging a message, it is logged with the SLF4J logger and also stored in the standard
log repository (for the bulletins). However if the array of objects contains the exception
(and not the message of the exception), this exception won't be displayed in the bulletin
message.
> That's because of:
> {code:title=StandardLogRepository.java|borderStyle=solid}
>     @Override
>     public void addLogMessage(final LogLevel level, final String format, final Object[]
params) {
>         final String formattedMessage = MessageFormatter.arrayFormat(format, params).getMessage();
>         addLogMessage(level, formattedMessage);
>     }
> {code}
> If the params object contains a Throwable object, it'll be removed from the array in
the {{MessageFormatter}}:
> {code:title=MessageFormatter.java|borderStyle=solid}
>     final public static FormattingTuple arrayFormat(final String messagePattern, final
Object[] argArray) {
>         Throwable throwableCandidate = getThrowableCandidate(argArray);
>         Object[] args = argArray;
>         if (throwableCandidate != null) {
>             args = trimmedCopy(argArray);
>         }
>         return arrayFormat(messagePattern, args, throwableCandidate);
>     }
> {code}
> Easy solution would be to change:
> {noformat}
> logger.debug("Failed to validate {} against schema due to {}", new Object[]{flowFile,
e});
> {noformat}
> into:
> {noformat}
> logger.debug("Failed to validate {} against schema due to {}", new Object[]{flowFile,
e.getLocalizedMessage()});
> {noformat}
> However this pattern can be found in quite a large number of places... And it'd be certainly
better to provide a permanent solution supporting the existing pattern. Suggestion is to modify
the method in {{StandardLogRepository}} to go through all the items of the array and for each
Throwable object, replace it by the localized message.



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

Mime
View raw message