Hi Russ,

Are you saying the code that breaks is having “getLogger()” executed inside one 
of the processor lifecycle methods (i.e. GetFile#onTrigger()) or in your test 
code (i.e. GetFileTest#testOnTriggerShouldReadFile())?

I’m not aware of anything with the JUnit runner that would cause issues here. I 
use the loggers extensively in both my application code [1] and the tests [2]. 
Obviously in the tests, I instantiate a new Logger instance for the test class.

Can you share an example of the code that breaks this for you?

[1] 
https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/EncryptContent.java#L511
 
<https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/EncryptContent.java#L511>
[2] 
https://github.com/apache/nifi/pull/2628/files#diff-e9cfa232683ae75b1fc505d6c9bd3b24R447
 
<https://github.com/apache/nifi/pull/2628/files#diff-e9cfa232683ae75b1fc505d6c9bd3b24R447>

Andy LoPresto
[email protected]
[email protected]
PGP Fingerprint: 70EC B3E5 98A6 5A3F D3C4  BACE 3C6E F65B 2F7D EF69

> On Apr 12, 2018, at 3:46 PM, Russell Bateman <[email protected]> wrote:
> 
> I seem to crash NiFi JUnit test runner when I have code that calls 
> getLogger()or attempts to make use of the product of calling getLogger()in 
> situations where some context (probably) is missing like methods annotated 
> for call at "special" times. This makes sense, but is there a technique I can 
> use to profile my custom processor in order to observe (easily, such as using 
> the logger) the behavior of (i.e.: log-TRACE through) my processor in respect 
> to @OnScheduled, @OnUnscheduled, @OnStopped, etc. moments?
> 
> Many thanks,
> Russ

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to