[
https://issues.apache.org/jira/browse/NIFI-1376?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15094087#comment-15094087
]
ASF GitHub Bot commented on NIFI-1376:
--------------------------------------
Github user markap14 commented on a diff in the pull request:
https://github.com/apache/nifi/pull/165#discussion_r49469400
--- 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 --
Can you explain why we have this CapturingLogger here, which implements
many methods, rather than just modifying the existing warn(), error(), etc.
methods? It seems that the capturing could happen within the MockProcessorLog,
rather than at a lower level. I feel like this would result in much simpler
code. But it's quite possible that I am missing something? Let me know what you
think!
> 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)