You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@nifi.apache.org by James McMahon <js...@gmail.com> on 2019/02/25 12:10:49 UTC

Tailor logback.xml custom Appender and Logging

A very helpful approach to redirecting logging for a particular processor
type is presented here:
https://community.hortonworks.com/questions/63071/in-apache-ni-fi-how-can-i-log-all-the-flowfile-att.html
. It shows how we can tailor logback.xml to redirect logging for a given
processor.

But this appears to redirect logging for every single instance of that
processor type globally across the nifi service. This would not be ideal:
for example, clearly others employing LogAttribute processors in their
process groups for their flows may not want their logging redirected to my
chosen log file for my LogAttribute instance.

Has anyone figured out how to use the approach described by the link above
- namely, add a custom Appender and Logger in logback.xml - to tailor the
customization to a specific processor instance? Or perhaps even limit it to
a particular Process Group?

Thank you.

Re: Tailor logback.xml custom Appender and Logging

Posted by James Srinivasan <ja...@gmail.com>.
I created a JIRA to log this here:

https://issues.apache.org/jira/browse/NIFI-6079

Please do comment - not sure my suggested approach is best

On Mon, 25 Feb 2019 at 20:19, Andy LoPresto <al...@apache.org> wrote:
>
> Hate to be “that guy”, but the simplest thing I can think of right now is set up a NiFi flow that tails nifi-app.log, looks for messages with the specific component ID, and puts them into another log (either MergeContent & PutFile, or ExecuteScript / ExecuteStreamCommand to just echo them out). I do not believe you can identify a specific instance of a processor via component ID in the logback settings.
>
> Andy LoPresto
> alopresto@apache.org
> alopresto.apache@gmail.com
> PGP Fingerprint: 70EC B3E5 98A6 5A3F D3C4  BACE 3C6E F65B 2F7D EF69
>
> On Feb 25, 2019, at 4:10 AM, James McMahon <js...@gmail.com> wrote:
>
> A very helpful approach to redirecting logging for a particular processor type is presented here: https://community.hortonworks.com/questions/63071/in-apache-ni-fi-how-can-i-log-all-the-flowfile-att.html . It shows how we can tailor logback.xml to redirect logging for a given processor.
>
> But this appears to redirect logging for every single instance of that processor type globally across the nifi service. This would not be ideal: for example, clearly others employing LogAttribute processors in their process groups for their flows may not want their logging redirected to my chosen log file for my LogAttribute instance.
>
> Has anyone figured out how to use the approach described by the link above - namely, add a custom Appender and Logger in logback.xml - to tailor the customization to a specific processor instance? Or perhaps even limit it to a particular Process Group?
>
> Thank you.
>
>

Re: Tailor logback.xml custom Appender and Logging

Posted by Andy LoPresto <al...@apache.org>.
Hate to be “that guy”, but the simplest thing I can think of right now is set up a NiFi flow that tails nifi-app.log, looks for messages with the specific component ID, and puts them into another log (either MergeContent & PutFile, or ExecuteScript / ExecuteStreamCommand to just echo them out). I do not believe you can identify a specific instance of a processor via component ID in the logback settings. 

Andy LoPresto
alopresto@apache.org
alopresto.apache@gmail.com
PGP Fingerprint: 70EC B3E5 98A6 5A3F D3C4  BACE 3C6E F65B 2F7D EF69

> On Feb 25, 2019, at 4:10 AM, James McMahon <js...@gmail.com> wrote:
> 
> A very helpful approach to redirecting logging for a particular processor type is presented here: https://community.hortonworks.com/questions/63071/in-apache-ni-fi-how-can-i-log-all-the-flowfile-att.html <https://community.hortonworks.com/questions/63071/in-apache-ni-fi-how-can-i-log-all-the-flowfile-att.html> . It shows how we can tailor logback.xml to redirect logging for a given processor.
> 
> But this appears to redirect logging for every single instance of that processor type globally across the nifi service. This would not be ideal: for example, clearly others employing LogAttribute processors in their process groups for their flows may not want their logging redirected to my chosen log file for my LogAttribute instance. 
> 
> Has anyone figured out how to use the approach described by the link above - namely, add a custom Appender and Logger in logback.xml - to tailor the customization to a specific processor instance? Or perhaps even limit it to a particular Process Group?
> 
> Thank you.


Re: Tailor logback.xml custom Appender and Logging

Posted by James Srinivasan <ja...@gmail.com>.
I suggested something similar here:

http://apache-nifi-users-list.2361937.n4.nabble.com/Demuxing-NiFi-logs-td5689.html

On Mon, 25 Feb 2019 at 12:11, James McMahon <js...@gmail.com> wrote:
>
> A very helpful approach to redirecting logging for a particular processor type is presented here: https://community.hortonworks.com/questions/63071/in-apache-ni-fi-how-can-i-log-all-the-flowfile-att.html . It shows how we can tailor logback.xml to redirect logging for a given processor.
>
> But this appears to redirect logging for every single instance of that processor type globally across the nifi service. This would not be ideal: for example, clearly others employing LogAttribute processors in their process groups for their flows may not want their logging redirected to my chosen log file for my LogAttribute instance.
>
> Has anyone figured out how to use the approach described by the link above - namely, add a custom Appender and Logger in logback.xml - to tailor the customization to a specific processor instance? Or perhaps even limit it to a particular Process Group?
>
> Thank you.