You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@nifi.apache.org by Richard Beare <ri...@gmail.com> on 2023/08/22 10:36:30 UTC

executescriipt and jython logging

Hi all,
I'm having issues with logging from python. I have the processor set to
debug level logging but I only see message from inside the callback;

i.e

flowFile = session.write(flowFile, PyStreamCallback())

calls to log.error and log.info from inside the process method of
PyStreamCallback() work fine.

However calls to log.error, log.warn etc from inside the typical "if
flowFile != None" block are not appearing as bulletins. They don't cause
errors either. What am I missing?

As an aside, I also seem to have trouble with changes to the script being
registered - that seems intermittent.

I'm using nifi 1.20

Thanks

Re: executescriipt and jython logging

Posted by Richard Beare <ri...@gmail.com>.
I'm using ExecuteScript. I don't see a change in behaviour if I click
"Verify".

On Wed, Aug 23, 2023 at 2:46 AM Matt Burgess <ma...@apache.org> wrote:

> Richard,
>
> I'll look into the logging stuff, definitely strange behavior. Are you
> using ExecuteScript or InvokeScriptedProcessor? I noticed an
> intermittent failure on InvokeScriptedProcessor in 1.20 [1] but maybe
> it's present in more of the scripting stuff as they use the same
> classes to handle the engines and scripts.
>
> Regards,
> Matt
>
> [1] https://issues.apache.org/jira/browse/NIFI-11148
>
> On Tue, Aug 22, 2023 at 7:19 AM Richard Beare <ri...@gmail.com>
> wrote:
> >
> > It seems stranger than I thought. I have the following in the callback:
> >
> >         log.info("Simple text")
> >         log.info("Block size " + str(type(block_of_days)) + "\n")
> >         log.info("Oldest time: " + oldest_time_str)
> >         log.info("Newest time: " + newest_time_str)
> >         log.info("Previous newest: " +
> iso2str.format(previous_last_timestamp))
> >
> > The last 3 (from "Oldest time") and another later info message which is
> a pure string appear in the log, but the first two don't.
> >
> >
> > On Tue, Aug 22, 2023 at 8:36 PM Richard Beare <ri...@gmail.com>
> wrote:
> >>
> >> Hi all,
> >> I'm having issues with logging from python. I have the processor set to
> debug level logging but I only see message from inside the callback;
> >>
> >> i.e
> >>
> >> flowFile = session.write(flowFile, PyStreamCallback())
> >>
> >> calls to log.error and log.info from inside the process method of
> PyStreamCallback() work fine.
> >>
> >> However calls to log.error, log.warn etc from inside the typical "if
> flowFile != None" block are not appearing as bulletins. They don't cause
> errors either. What am I missing?
> >>
> >> As an aside, I also seem to have trouble with changes to the script
> being registered - that seems intermittent.
> >>
> >> I'm using nifi 1.20
> >>
> >> Thanks
>

Re: executescriipt and jython logging

Posted by Matt Burgess <ma...@apache.org>.
Richard,

I'll look into the logging stuff, definitely strange behavior. Are you
using ExecuteScript or InvokeScriptedProcessor? I noticed an
intermittent failure on InvokeScriptedProcessor in 1.20 [1] but maybe
it's present in more of the scripting stuff as they use the same
classes to handle the engines and scripts.

Regards,
Matt

[1] https://issues.apache.org/jira/browse/NIFI-11148

On Tue, Aug 22, 2023 at 7:19 AM Richard Beare <ri...@gmail.com> wrote:
>
> It seems stranger than I thought. I have the following in the callback:
>
>         log.info("Simple text")
>         log.info("Block size " + str(type(block_of_days)) + "\n")
>         log.info("Oldest time: " + oldest_time_str)
>         log.info("Newest time: " + newest_time_str)
>         log.info("Previous newest: " + iso2str.format(previous_last_timestamp))
>
> The last 3 (from "Oldest time") and another later info message which is a pure string appear in the log, but the first two don't.
>
>
> On Tue, Aug 22, 2023 at 8:36 PM Richard Beare <ri...@gmail.com> wrote:
>>
>> Hi all,
>> I'm having issues with logging from python. I have the processor set to debug level logging but I only see message from inside the callback;
>>
>> i.e
>>
>> flowFile = session.write(flowFile, PyStreamCallback())
>>
>> calls to log.error and log.info from inside the process method of PyStreamCallback() work fine.
>>
>> However calls to log.error, log.warn etc from inside the typical "if flowFile != None" block are not appearing as bulletins. They don't cause errors either. What am I missing?
>>
>> As an aside, I also seem to have trouble with changes to the script being registered - that seems intermittent.
>>
>> I'm using nifi 1.20
>>
>> Thanks

Re: executescriipt and jython logging

Posted by Richard Beare <ri...@gmail.com>.
It seems stranger than I thought. I have the following in the callback:

        log.info("Simple text")
        log.info("Block size " + str(type(block_of_days)) + "\n")
        log.info("Oldest time: " + oldest_time_str)
        log.info("Newest time: " + newest_time_str)
        log.info("Previous newest: " +
iso2str.format(previous_last_timestamp))

The last 3 (from "Oldest time") and another later info message which is a
pure string appear in the log, but the first two don't.


On Tue, Aug 22, 2023 at 8:36 PM Richard Beare <ri...@gmail.com>
wrote:

> Hi all,
> I'm having issues with logging from python. I have the processor set to
> debug level logging but I only see message from inside the callback;
>
> i.e
>
> flowFile = session.write(flowFile, PyStreamCallback())
>
> calls to log.error and log.info from inside the process method of
> PyStreamCallback() work fine.
>
> However calls to log.error, log.warn etc from inside the typical "if
> flowFile != None" block are not appearing as bulletins. They don't cause
> errors either. What am I missing?
>
> As an aside, I also seem to have trouble with changes to the script being
> registered - that seems intermittent.
>
> I'm using nifi 1.20
>
> Thanks
>