我使用Python引擎实现了Nifi ExecuteScript处理器,将脚本文件属性指向ExecuteScript处理器中的Python文件。在我的Python代码中,我使用了log.error('Error')和log.info('Hello'),但我只能在nifi-app.log文件中看到log.error,而log.info没有显示。
flowFile = session.get()
if flowFile != None:
try:
log.info('Info >> Python processor started') #1
log.error('Python processor started') #2
applicationId = flowFile.getAttribute('http.param.applicationId')
flowFile = session.write(flowFile, ModJSON())
flowFile = session.putAttribute(flowFile, "filename",
flowFile.getAttribute('filename').split('.')[0] + '_translated_response.json')
flowFile = session.putAttribute(flowFile,"http.param.applicationId",applicationId)
session.transfer(flowFile, REL_SUCCESS)
log.error('Python processor completed')
except:
log.error('Error while sequencing ')
session.transfer(flowFile, REL_FAILURE)
session.commit()
从上面的代码中可以看到,第2行在日志文件中显示错误,但第1行没有被记录
<logger name="org.apache.nifi.processors.script.ExecuteScript" level="INFO"/>
顺便提一下,设置选项后请重新启动nifi。 - Lamanus