Russell,

Generally, no. Logback is not typically included on the class path for 
Processors but instead is inherited at the root level of NiFi’s class loader 
hierarchy. For processors, you should generally add a *test* dependency on 
slf4j-simple. You can then configure that via a file in your src/test/resources 
directory, or you can configure it using System properties directly within the 
test class.

Thanks
-Mark


> On Jan 31, 2025, at 1:15 PM, Russell Bateman <[email protected]> wrote:
> 
> Should not a file in my IntelliJ IDEA project on the path 
> /*project/src/test/resources/logback-test.xml*/,
> 
> containing:
> 
>   <configuration>
>      <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
>        <encoder
>   class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
>          <pattern>%-4relative [%thread] %-5level
>   %logger{5}.%method:%line - %message%n</pattern>
>        </encoder>
>      </appender>
> 
>   *  <logger name="com.windofkeltia.processor" level="TRACE"
>   additivity="false">
>        <appender-ref ref="CONSOLE" />
>      </logger>*
> 
>      <root level="TRACE">
>        <appender-ref ref="CONSOLE" />
>      </root>
>   </configuration>
> 
> 
> show me ComponentLog statements inside onTrigger() such as:
> 
>   *getLogger()**.debug( "Log statement stuff..." );*
> 
> 
> I'm debugging on Apache NiFi 1.28.1. My JUnit set-up, which works, but just 
> doesn't yield to my non-INFO logging requests. My JUnit code looks as you'd 
> expect:
> 
>   private ProcessorName processor;
>   private TestRunner    runner;
> 
>   @Test
>   public void test()
>   {
>        runner = TestRunners.newTestRunner( processor = new
>   ProcessorName() );
>        runner.setValidateExpressionUsage( false );
>        ... (etc.)
>        runner.enqueue( new ByteArrayInputStream( CONTENT.getBytes() ) );
>        runner.run( 1 );
>        ...
>   }
> 
> 
> As I say, everything is working impeccably (JUnit, my processor, everything), 
> I just can't get logging tailored to show me TRACE, DEBUG, etc. in JUnit 
> tests run inside IntelliJ IDEA without changing them to INFO. I have also 
> tried modifying the "same" file on the path 
> /*project/src/main/resources/logback.xml*/.
> 
> Thanks,
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 

Reply via email to