[
https://issues.apache.org/jira/browse/NIFI-1376?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15090958#comment-15090958
]
Richard Miskin commented on NIFI-1376:
--------------------------------------
[~joewitt] Because the log messages are exposed (or can be exposed) as
bulletins within the NiFi UI I see them as outputs from the Processor. I'd
probably assert on errors/warn cases and not worry to much about anything lower.
At the moment (and I've not got a flow running with real users yet) I'm seeing
provenance as a way to find out what has happened and the running flow
(including bulletins) as a way to see what is currently happening. Both are
useful but serve different slightly different purposes. Including the error
details within the Provence record does sound handy, especially when trying to
deal with intermittently flakey external services.
Looking at PutJMS as a random example, the log message includes the errors
details, but I don't think the provence record would:
{code}
try {
wrappedProducer = JmsFactory.createMessageProducer(context,
true);
logger.info("Connected to JMS server {}", new
Object[]{context.getProperty(URL).getValue()});
} catch (final JMSException e) {
logger.error("Failed to connect to JMS Server due to {}", new
Object[]{e});
session.transfer(flowFiles, REL_FAILURE);
context.yield();
return;
}
{code}
In error cases would it be considered better practice to make explicit calls to
session.getProvenanceReporter()?
{code}
if (wrappedProducer == null) {
try {
wrappedProducer = JmsFactory.createMessageProducer(context,
true);
logger.info("Connected to JMS server {}", new
Object[]{context.getProperty(URL).getValue()});
} catch (final JMSException e) {
logger.error("Failed to connect to JMS Server due to {}", new
Object[]{e});
for (FlowFile flowFile : flowFiles) {
session.getProvenanceReporter().route(flowFile, REL_FAILURE,
String.format("Failed to connect to JMS Server due
to {}", new Object[] { e }));
}
session.transfer(flowFiles, REL_FAILURE);
context.yield();
return;
}
}
{code}
I've not looked too much at using explicit calls to the ProvenanceReporter in
processors that I've written but I'll bear it in mind in future.
> 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)