Half_Duplex
Half_Duplex

Reputation: 5234

Using custom logging filter with LoggingFeature for Jersey Client.

I am using Jersey 2.22. I have registered a LoggingFeature that logs requests, responses, headers, payload, etc based on the verbosity that I set however I would like to implement my own custom logging filter that this feature will use.

Looking at the source of LoggingFeature, it doesn't appear this is possible. This seems very inflexible. With previous versions of Jersey, it was very simple to implement a LoggingFilter and register it on the client.

I'd really like to implement my own version of ClientLoggingFilter so I can write a neat line to my log.

Any suggestions? The documentation is lacking IMO. https://jersey.github.io/documentation/latest/logging_chapter.html#d0e15744

Upvotes: 4

Views: 3240

Answers (1)

Half_Duplex
Half_Duplex

Reputation: 5234

The solution for me was to implement my own version of a LoggingFeature with a custom request/response container injected. Within the container I did the exact logging that we required.

Seems like a step backwards not being able to implement a simple filter and apply it to the client for things like custom logging.

Upvotes: 2

Related Questions