nifi-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bryan Bende <bbe...@gmail.com>
Subject Re: ComponentLog and JUnit
Date Wed, 27 Sep 2017 15:08:31 GMT
I think another option is to use the simple SLF4J logger....

<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-simple</artifactId>
    <scope>test</scope>
</dependency>

Then you probably wouldn't need the logback.xml file since you
wouldn't be logging through logback at that point.


On Wed, Sep 27, 2017 at 10:40 AM, Ryan H <rhendrickson.work@gmail.com> wrote:
> I figured it out... I was missing the logback-test.xml file (now included)
> and in my pom.xml:
>
> I had:
> <dependency>
>    <groupId>ch.qos.logback</groupId>
>    <artifactId>logback-core</artifactId>
>    <scope>test</scope>
> </dependency>
>
> Instead I swapped to:
>
> <dependency>
>    <groupId>ch.qos.logback</groupId>
>    <artifactId>logback-classic</artifactId>
>    <scope>test</scope>
> </dependency>
>
> And the logs are outputting now.
>
> Ryan
>
>
> On Wed, Sep 27, 2017 at 10:20 AM, Ryan H <rhendrickson.work@gmail.com>
> wrote:
>>
>> Hi Andy,
>>    It's a custom processor I'm writing.  I was scratching my head
>> wondering if that is it, or adding a test dependency for logback has
>> something to do with it.
>>
>>    I just copy/pasted this one:
>> https://github.com/apache/nifi/blob/d838f61291d2582592754a37314911b701c6891b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/resources/logback-test.xml
>> and droped it into my src/test/resources
>>
>>   No such luck at seeing logs yet in my output yet.
>>
>> Ryan
>>
>> On Tue, Sep 26, 2017 at 5:59 PM, Andy LoPresto <alopresto@apache.org>
>> wrote:
>>>
>>> Ryan,
>>>
>>> Which module is this running in? Some modules have a logback.xml file
>>> defined in /src/test/resources/logback.xml which configures the test
>>> loggers, while others do not. If this is not configured in your module, you
>>> won’t see the error messages on the console. You can copy an existing
>>> logback.xml file from one of the other modules (be sure to use one from the
>>> *test* directory, not the *main* directory).
>>>
>>>
>>> Andy LoPresto
>>> alopresto@apache.org
>>> alopresto.apache@gmail.com
>>> PGP Fingerprint: 70EC B3E5 98A6 5A3F D3C4  BACE 3C6E F65B 2F7D EF69
>>>
>>> On Sep 26, 2017, at 2:51 PM, Ryan H <rhendrickson.work@gmail.com> wrote:
>>>
>>> Hi,
>>>    I'm curious if there's a way to get the ComponentLog to output to
>>> StandardOut during a Unit Test.
>>>
>>>    I see I can access them when I call
>>> testRunner.getLogger().getErrorMessages(), however, I'd really like to see a
>>> stacktrace if it happens without having to iterate through an array to find
>>> it.
>>>
>>>    I feel like I'm just missing something obvious here, I'd appreciate
>>> any advice.
>>>
>>> Thanks,
>>> Ryan
>>>
>>>
>>
>

Mime
View raw message