You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by kotarot <gi...@git.apache.org> on 2018/11/01 07:53:05 UTC

[GitHub] nifi pull request #3122: NIFI-5777: Update the tag and the property of LogMe...

GitHub user kotarot opened a pull request:

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

    NIFI-5777: Update the tag and the property of LogMessage

    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:
    - [X] Is there a JIRA ticket associated with this PR? Is it referenced 
         in the commit message?
    
    - [X] 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.
    
    - [X] Has your PR been rebased against the latest commit within the target branch (typically master)?
    
    - [X] 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:
    - [X] 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/kotarot/nifi NIFI-5777

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

    https://github.com/apache/nifi/pull/3122.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 #3122
    
----
commit 0e7a61cc6b807879d09e5f3b97afccf6def39155
Author: Kotaro Terada <ko...@...>
Date:   2018-11-01T07:40:17Z

    NIFI-5777: Update the tag and the property of LogMessage

----


---

[GitHub] nifi pull request #3122: NIFI-5777: Update the tag and the property of LogMe...

Posted by pvillard31 <gi...@git.apache.org>.
Github user pvillard31 commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/3122#discussion_r230709356
  
    --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestLogMessage.java ---
    @@ -57,7 +57,7 @@ MockComponentLog getMockComponentLog() {
         public void before() throws InitializationException {
             testableLogMessage = new TestableLogMessage();
             runner = TestRunners.newTestRunner(testableLogMessage);
    -
    +        runner.setValidateExpressionUsage(false);
    --- End diff --
    
    Yeah sounds good to me to have EL support ;)


---

[GitHub] nifi pull request #3122: NIFI-5777: Update the tag and the property of LogMe...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

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


---

[GitHub] nifi pull request #3122: NIFI-5777: Update the tag and the property of LogMe...

Posted by pvillard31 <gi...@git.apache.org>.
Github user pvillard31 commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/3122#discussion_r230300635
  
    --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestLogMessage.java ---
    @@ -57,7 +57,7 @@ MockComponentLog getMockComponentLog() {
         public void before() throws InitializationException {
             testableLogMessage = new TestableLogMessage();
             runner = TestRunners.newTestRunner(testableLogMessage);
    -
    +        runner.setValidateExpressionUsage(false);
    --- End diff --
    
    In that case I'm not sure to understand the intent of this PR. Initially I thought it was about removing ``.expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES)`` on ``LOG_LEVEL`` since the property only accepts a list of allowed values. If we do that, then we should remove the  ``.evaluateAttributeExpressions(flowFile)``, no?
    
    On the other hand, if we do want to allow EL on this property, then the property and code should be changed to allow free text value that is validated against the list of allowed values only if EL is not used. And then if EL is used, there should be a default behavior in case the value, after EL evaluation, is not an allowed value.
    
    Am I missing something?


---

[GitHub] nifi pull request #3122: NIFI-5777: Update the tag and the property of LogMe...

Posted by pvillard31 <gi...@git.apache.org>.
Github user pvillard31 commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/3122#discussion_r230022659
  
    --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestLogMessage.java ---
    @@ -57,7 +57,7 @@ MockComponentLog getMockComponentLog() {
         public void before() throws InitializationException {
             testableLogMessage = new TestableLogMessage();
             runner = TestRunners.newTestRunner(testableLogMessage);
    -
    +        runner.setValidateExpressionUsage(false);
    --- End diff --
    
    I disagree with this change: disabling the expression usage validation should be avoided as much as possible and, if I recall correctly, is only necessary in very specific edge cases. Instead of disabling the validation, I'd fix the original issue by removing ``.evaluateAttributeExpressions(flowFile)`` on L129 in LogMessage since it does not make sense. Once it's fixed, I'm a +1 and can merge to master. Feel free to squash your commits. Thanks!


---

[GitHub] nifi issue #3122: NIFI-5777: Update the tag and the property of LogMessage

Posted by kotarot <gi...@git.apache.org>.
Github user kotarot commented on the issue:

    https://github.com/apache/nifi/pull/3122
  
    @pvillard31 @ijokarumawak Updated the property to support EL. Would you please check it?


---

[GitHub] nifi issue #3122: NIFI-5777: Update the tag and the property of LogMessage

Posted by ijokarumawak <gi...@git.apache.org>.
Github user ijokarumawak commented on the issue:

    https://github.com/apache/nifi/pull/3122
  
    LGTM, +1. Merging. Thanks @kotarot !


---

[GitHub] nifi pull request #3122: NIFI-5777: Update the tag and the property of LogMe...

Posted by ijokarumawak <gi...@git.apache.org>.
Github user ijokarumawak commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/3122#discussion_r230526767
  
    --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestLogMessage.java ---
    @@ -57,7 +57,7 @@ MockComponentLog getMockComponentLog() {
         public void before() throws InitializationException {
             testableLogMessage = new TestableLogMessage();
             runner = TestRunners.newTestRunner(testableLogMessage);
    -
    +        runner.setValidateExpressionUsage(false);
    --- End diff --
    
    Sorry for the confusion. I was just looking at the source code. When I run the processor, I realized that the processor doesn't allow EL. The logLevel is shown as a free text input, and I can input EL, but validation failed because of the configured allowable values.
    
    I still think changing log level by EL would be nice:
    ![image](https://user-images.githubusercontent.com/1107620/47943878-b191ff80-df3b-11e8-9456-939900b53e0e.png)
    
    My suggestion is, changing:
    
    ```
                .description("The Log Level to use when logging the message")
                .allowableValues(MessageLogLevel.values())
    ```
    
    to 
    
    ```
                .description("The Log Level to use when logging the message: " + Arrays.toString(MessageLogLevel.values()))
                .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
    ```
    
    How do you guys think?


---

[GitHub] nifi pull request #3122: NIFI-5777: Update the tag and the property of LogMe...

Posted by ijokarumawak <gi...@git.apache.org>.
Github user ijokarumawak commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/3122#discussion_r230257806
  
    --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestLogMessage.java ---
    @@ -57,7 +57,7 @@ MockComponentLog getMockComponentLog() {
         public void before() throws InitializationException {
             testableLogMessage = new TestableLogMessage();
             runner = TestRunners.newTestRunner(testableLogMessage);
    -
    +        runner.setValidateExpressionUsage(false);
    --- End diff --
    
    Hmm, I think changing logLevel based on expression makes sense. For example, if you want to debug for a particular type of FlowFiles, you'd use EL to write WARN level log for specific attribute value and use TRACE/DEBUG for others to minimize the noise. I don't think specifying log level by text is a critical issue..


---

[GitHub] nifi pull request #3122: NIFI-5777: Update the tag and the property of LogMe...

Posted by kotarot <gi...@git.apache.org>.
Github user kotarot commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/3122#discussion_r230650492
  
    --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestLogMessage.java ---
    @@ -57,7 +57,7 @@ MockComponentLog getMockComponentLog() {
         public void before() throws InitializationException {
             testableLogMessage = new TestableLogMessage();
             runner = TestRunners.newTestRunner(testableLogMessage);
    -
    +        runner.setValidateExpressionUsage(false);
    --- End diff --
    
    @pvillard31 @ijokarumawak Thank you for your reviews.
    
    At first, the purpose of my PR was, to enable to pick up a Log Level from the pull-down list (as we can do it on the LogAttribute processor), so that I would like to make it easier for users (including NiFi beginners) to use this processor.
    
    As @ijokarumawak has suggested, should I fix it to be EL acceptable for flexible logging usages?


---