I am trying to log with Jersey 2.23. Since this version, the class LoggingFilter
is deprecated, as one can read for example here: https://jersey.java.net/documentation/latest/logging_chapter.html. So I have to use LoggingFeature
instead.
What did not work was the register
method of ResourceConfig
as it is explained in this documentation. But in the end the property
method worked:
client.property(LoggingFeature.LOGGING_FEATURE_LOGGER_LEVEL_SERVER, "WARN");
This prints every message as a warning. Unfortunately it is documented nowhere (at least I couldn't find anything) which values are allowed. Obviously it has to be a String, because I get a log message that there is no way to transform the value into a String, when I try anything else than a String. Now I want to log this messages with level TRACE and I can't find a suiting String to achieve this. "TRACE" and "FINE" did not work for example, in these cases nothing is logged. I have to mention that I use Log4j2 together with the Slf4jBridgeHandler because Jersey uses JUL.