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

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

Github user olegz commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/165#discussion_r49470011
  
    --- Diff: 
nifi-mock/src/main/java/org/apache/nifi/util/MockProcessorLog.java ---
    @@ -16,20 +16,57 @@
      */
     package org.apache.nifi.util;
     
    +import java.util.List;
    +
     import org.apache.nifi.logging.ProcessorLog;
     import org.slf4j.Logger;
     import org.slf4j.LoggerFactory;
     
     public class MockProcessorLog implements ProcessorLog {
     
    -    private final Logger logger;
    +    private final CapturingLogger logger;
         private final Object component;
     
         public MockProcessorLog(final String componentId, final Object 
component) {
    -        this.logger = LoggerFactory.getLogger(component.getClass());
    +        this.logger = new 
CapturingLogger(LoggerFactory.getLogger(component.getClass()));
    --- End diff --
    
    Also, there may be a simpler way to do what I believe you are trying. Just 
look at here 
https://github.com/apache/nifi/pull/167/files#diff-d4270631731d05831ae336a5e6e50ad2R54.
 NOTE: that wit this approach you'll get access to the entire message after its 
being formatted, thus validating values in {..}


> Provide access to logged messages from TestRunner
> -------------------------------------------------
>
>                 Key: NIFI-1376
>                 URL: https://issues.apache.org/jira/browse/NIFI-1376
>             Project: Apache NiFi
>          Issue Type: Improvement
>    Affects Versions: 0.4.1
>            Reporter: Richard Miskin
>            Priority: Minor
>             Fix For: 0.5.0
>
>
> It would be useful to be able to verify the log messages raised by Processors 
> and ControllerServices during tests.
> As an example use case, imagine a processor with multiple possible errors 
> that should cause a flow file to be transferred to a failure Relationship, 
> but different messages should be logged.



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

Reply via email to