[
https://issues.apache.org/jira/browse/NIFI-1376?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15090780#comment-15090780
]
ASF GitHub Bot commented on NIFI-1376:
--------------------------------------
GitHub user rpmiskin opened a pull request:
https://github.com/apache/nifi/pull/165
NIFI-1376 Provide access to logged messages from TestRunner
Here is a possible mechanism to allow Processor unit tests to access and
verify messages written to the log. All fields passed to the logger are
available within the test: Marker, message/format, Throwable and any arguments.
Example usage:
final List<LogMessage> errorMessages =
runner.getLogger().getErrorMessages();
assertEquals("Expect a single ERROR level message", 1,
errorMessages.size());
assertEquals("{} Failed to convert {} from Avro to JSON due to {};
transferring to failure: {}",
runner.getLogger().getErrorMessages().get(0).getMsg());
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/rpmiskin/nifi NIFI-1376
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/nifi/pull/165.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 #165
----
commit a48ea143198c5c0f3d223fee6dce9ed45d62e2a3
Author: Richard Miskin <[email protected]>
Date: 2016-01-09T20:39:57Z
NIFI-1376 Provide access to logged messages from TestRunner
----
> 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
>
> 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)