0

Take http://smile.amazon.com/` for example. It has

  1. Redirect from http to https
  2. Invalid domain cookies

I'm using Jersey as a HTTP client, but because of #1 I'm using it with ApacheConnectorProvider as default HttpURLConnection doesn't follow http-to-https redirect.

I want to capture the #2 warnings to SLF4J with logback so I'm using jul-to-slf4j bridge.

enter image description here

SLF4JBridgeHandler.removeHandlersForRootLogger();
SLF4JBridgeHandler.install();

enter image description here

It seems to work exactly as I want it to, but documentation strongly suggests using LevelChangePropagator for performance reasons.

<contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator">
    <resetJUL>true</resetJUL>
</contextListener>

However, it is now logging way too much.

enter image description here

How can I configure Jersey and/or Apache HttpClient internals to be much less verbose?

Ilya Kozhevnikov
  • 10,242
  • 4
  • 40
  • 70
  • Your logback-level is set to debug, with the `LevelChangePropagator`, the jul-level is also on Debug, thats why you'll get all the message. See the possible dublicate on how to change the level for the package `org.apache.http` to warn – hinneLinks Apr 08 '16 at 10:10
  • @hinneLinks there seem to be a ton of packages involved, I'd like to configure it in client, rather than filter in logback, if possible. – Ilya Kozhevnikov Apr 08 '16 at 10:10
  • Then you'll either need to adjust the jul-configuration or remove the `LevelChangePropagator`. The Performance impact will happen, if jul creates a lot of debug-messages, that are filtered by logback in the end. if jul doesn't create them in the first place you should be fine (you don't see the debug-messages in the second screenshot, so i assume the jul-level is on info by default) – hinneLinks Apr 08 '16 at 10:19
  • @hinneLinks thanks – Ilya Kozhevnikov Apr 08 '16 at 11:28

0 Answers0