Russell, 

You can put a file called logback-test.xml in the src/test/resources/ directory 
of your custom processor module. This file is the same format as logback.xml 
but will supersede it for unit test execution. You can configure whatever level 
of logging severity and specificity in the same way you would in the production 
file. 

Here is an example in nifi-security-utils [1]. 

[1] 
https://github.com/apache/nifi/blob/master/nifi-commons/nifi-security-utils/src/test/resources/logback-test.xml
 
<https://github.com/apache/nifi/blob/master/nifi-commons/nifi-security-utils/src/test/resources/logback-test.xml>

Andy LoPresto
alopre...@apache.org
alopresto.apa...@gmail.com
PGP Fingerprint: 70EC B3E5 98A6 5A3F D3C4  BACE 3C6E F65B 2F7D EF69

> On Mar 6, 2020, at 12:13 PM, Russell Bateman <r...@windofkeltia.com> wrote:
> 
> I'm interested in getting log statements that may occur from my *custom 
> processor* code at the INFO, DEBUGand TRACElevels when running unit tests for 
> it. This means that I would like to set (programmatically at runtime or by 
> configuration) what I am used to setting in 
> /${NIFI_ROOT}///conf/logback.xml/, but effectively in/during my unit tests 
> (using NiFi's TestRunner). And, obviously, I'd like to see those log 
> statements come out to the console.
> 
> Thanks for any advice.
> 

Reply via email to