You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@nifi.apache.org by Mike Thomsen <mi...@gmail.com> on 2020/11/12 15:28:51 UTC

Setting up debug logging on InvokeHttp

I'm trying to get a good look at the request that is being sent over.
Does anyone know what sort of logback configuration would work best
for showing the headers and the body being sent?

Thanks,

Mike

Re: Setting up debug logging on InvokeHttp

Posted by Joey Frazee <jo...@icloud.com>.
If this is just a one off/short term debugging thing I’ve found mitmproxy to be helpful for this. If you configure it as the proxy it works as you’d expect.

-joey

On Nov 12, 2020, 8:53 AM -0800, Etienne Jouvin <la...@gmail.com>, wrote:
> Hello.
>
> InvokeHTTP is using  OkHttpClient
> See on OkHttpClient the logging configuration.
> But if it required to add an interceptor, it will not be easy.
>
>
> But in the code, you will find something like :
>     private void logRequest(ComponentLog logger, Request request) {
>         logger.debug("\nRequest to remote service:\n\t{}\n{}",
>                 new Object[]{request.url().url().toExternalForm(), getLogString(request.headers().toMultimap())});
>     }
>
> You can put something like this in the logback.xml configuration
>
>     <logger name="org.apache.nifi.processors.standard.InvokeHTTP" level="DEBUG" additivity="false">
>         <appender-ref ref="APP_FILE" />
>     </logger>
>
> This will not log the body, but you will have the headers.
>
> Etienne
>
>
>
>
Le jeu. 12 nov. 2020 à 16:29, Mike Thomsen <mi...@gmail.com> a écrit :
> I'm trying to get a good look at the request that is being sent over.
> Does anyone know what sort of logback configuration would work best
> for showing the headers and the body being sent?
>
> Thanks,
>
> Mike

Re: Setting up debug logging on InvokeHttp

Posted by Etienne Jouvin <la...@gmail.com>.
Hello.

InvokeHTTP is using  OkHttpClient
See on OkHttpClient the logging configuration.
But if it required to add an interceptor, it will not be easy.


But in the code, you will find something like :
    private void logRequest(ComponentLog logger, Request request) {
        logger.debug("\nRequest to remote service:\n\t{}\n{}",
                new Object[]{request.url().url().toExternalForm(),
getLogString(request.headers().toMultimap())});
    }

You can put something like this in the logback.xml configuration

    <logger name="org.apache.nifi.processors.standard.InvokeHTTP"
level="DEBUG" additivity="false">
        <appender-ref ref="APP_FILE" />
    </logger>

This will not log the body, but you will have the headers.

Etienne




Le jeu. 12 nov. 2020 à 16:29, Mike Thomsen <mi...@gmail.com> a
écrit :

> I'm trying to get a good look at the request that is being sent over.
> Does anyone know what sort of logback configuration would work best
> for showing the headers and the body being sent?
>
> Thanks,
>
> Mike
>