About Logger
Class
nifiapi.logging.Logger
Every instance of a Processor will be automatically provisioned with a logger, accessible throughself.logger
. Importantly, the logger
instance supplied is not an instance of Python logger, but a Proxy to the Java logger object, and therefore available methods differ.
caution
Note that nifi.logging.Logger
class does not have warning
method; Use logger.warn
instead.
Here is a breakdown of how the two relate to each other:
Standard Python Logger | NiFi API Logger |
---|---|
noset | |
trace | |
debug | debug |
info | info |
warning | warn |
error | error |
critical |
e.g.:
from nifiapi.flowfiletransform import (
FlowFileTransform,
FlowFileTransformResult,
)
class Processor(FlowFileTransform):
(...)
def transform(
self, context: ProcessContext, flow_file
) -> FlowFileTransformResult:
'''
Parameters:
context (ProcessContext)
flow_file
Returns:
FlowFileTransformResult
'''
self.logger.warn("Called transform method.")
return FlowFileTransformResult("success")