Requests outgoing not logging in logbook zalando

606 Views Asked by At

Why requests outgoing not logging with logbook ?

I have a unit test:

@Test
public void logRequestBodyTest() {

    Logbook logbook = Logbook.builder()
            .sink(new DefaultSink(
                    new DefaultHttpLogFormatter(),
                    new DefaultHttpLogWriter()
            ))
            .build();

    final LogbookClientFilter filter = new LogbookClientFilter(logbook);
    final LogbookHttpRequestInterceptor interceptor = new LogbookHttpRequestInterceptor(logbook);
    final ResteasyClient client = new ResteasyClientBuilder().register(filter).build();

    final Response response = client.target("http://localhost:15555/test/management").request().get();

}

logs:

[15:51:13,553] [DEBUG] [main][,,][RequestAddCookies.process(123)] CookieSpec selected: default
[15:51:13,560] [DEBUG] [main][,,][RequestAuthCache.process(77)] Auth cache not set in the context
[15:51:13,560] [DEBUG] [main][,,][PoolingHttpClientConnectionManager.requestConnection(265)] Connection request: [route: {}->http://localhost:15555][total kept alive: 0; route allocated: 0 of 50; total allocated: 0 of 50]
[15:51:13,577] [DEBUG] [main][,,][PoolingHttpClientConnectionManager.leaseConnection(309)] Connection leased: [id: 0][route: {}->http://localhost:15555][total kept alive: 0; route allocated: 1 of 50; total allocated: 1 of 50]
[15:51:13,577] [DEBUG] [main][,,][MainClientExec.execute(235)] Opening connection {}->http://localhost:15555
[15:51:13,596] [DEBUG] [main][,,][DefaultHttpClientConnectionOperator.connect(139)] Connecting to localhost/127.0.0.1:15555
[15:51:13,597] [DEBUG] [main][,,][DefaultHttpClientConnectionOperator.connect(146)] Connection established 127.0.0.1:53944<->127.0.0.1:15555
[15:51:13,597] [DEBUG] [main][,,][MainClientExec.execute(256)] Executing request GET /test/management HTTP/1.1
[15:51:13,597] [DEBUG] [main][,,][MainClientExec.execute(261)] Target auth state: UNCHALLENGED
[15:51:13,597] [DEBUG] [main][,,][MainClientExec.execute(267)] Proxy auth state: UNCHALLENGED
[15:51:13,597] [DEBUG] [main][,,][headers.onRequestSubmitted(133)] http-outgoing-0 >> GET /test/management HTTP/1.1
[15:51:13,597] [DEBUG] [main][,,][headers.onRequestSubmitted(136)] http-outgoing-0 >> Host: localhost:15555
[15:51:13,597] [DEBUG] [main][,,][headers.onRequestSubmitted(136)] http-outgoing-0 >> Connection: Keep-Alive
[15:51:13,597] [DEBUG] [main][,,][headers.onRequestSubmitted(136)] http-outgoing-0 >> User-Agent: Apache-HttpClient/4.5.4 (Java/11.0.2)
[15:51:13,630] [DEBUG] [main][,,][headers.onResponseReceived(122)] http-outgoing-0 << HTTP/1.0 400 Bad Request
[15:51:13,664] [DEBUG] [Finalizer][,,][DefaultManagedHttpClientConnection.close(79)] http-outgoing-0: Close connection
0

There are 0 best solutions below