That would be the general idea, you'd probably need create a Controller Service interface and implementation [1] that would take the result and write it out to a file. The filename could be part of the method signature.
Another alternative would be to use NiFi's logging framework and configure logback [2] (via conf/logback.xml) and get a logger via slf4j with the name that matches the logger you've defined in the logback file. Thanks, Bryan [1] http://www.nifi.rocks/developing-a-custom-apache-nifi-controller-service/ [2] https://logback.qos.ch/manual/configuration.html On Tue, Mar 28, 2017 at 11:09 AM, James McMahon <[email protected]> wrote: > Thank you Bryan. So would the Controller Service serve as an interface > through which I direct log messages to a log file that I stipulate? Similar > to how we can set up different SSL Context Services that relate to > different cert authorities? If so, then that would help. > > Let me describe my requirement, and see if you think a Controller Service > is suitable. My challenge right now: > I have python scripts. They build json objects I save as flowfile content > using a PyStreamCallback. I wish to output these results to log file > logs/A.log from ExecuteScript instance A, logs/B.log from ExecuteScript > instance B, etc. > Evidently in Python you need to set up loggers and file handles to these > loggers once. If I embed that in my python script, it will do that every > time a flow file is processed by the ExecuteScript instance. > Would the Controller Service establish those one-time loggers and one-time > file handles for us, which I could then reference in my python scripts in > Execute Script A and B? > > If this is what you envision, then it would be something of interest. -Jim > > On Tue, Mar 28, 2017 at 10:56 AM, Bryan Rosander <[email protected]> > wrote: > >> Hey James, >> >> I wonder if you'd be better suited with a Controller Service that could >> provide access to configured loggers, etc. >> >> It looks like ExecuteScript can lookup Controller Services [1]. A >> script-based Controller Service implementation (so you could use python or >> another scripting language there as well) seems like it might be a useful >> feature. If there's interest, I could write up a Jira for it. >> >> Thanks, >> Bryan >> >> [1] http://funnifi.blogspot.com/2016/04/sql-in-nifi-with-exe >> cutescript.html >> >> On Tue, Mar 28, 2017 at 10:48 AM, James McMahon <[email protected]> >> wrote: >> >>> Hello. I am interested in calling a python script from ExecuteScript >>> that sets up Python loggers and establishes file handles to those loggers >>> for use by other python scripts called later in the workflow by other >>> ExecuteScript processors. Is there a means to execute a script at workflow >>> inception - once only, not once per flowfile? I have found some retry count >>> examples in the open source literature, but those seem to enforce counts at >>> the flowfile level. In other words the counter restriction sets to 0 for >>> each flowfile. Thank you for any insights. -Jim >>> >> >> >
