I'm trying to configure Jersey using Annotation instead of XML, while doing that I had to change LoggingFilter to LoggingFeature.
I manage to find how to do the same with the later, but I really can't find any way to remove JUL logging and to have ONLY SLF4j/Logback.
Here is my configuration:
@ApplicationPath("rest")
public class JerseyConfiguration extends ResourceConfig {
public JerseyConfiguration() {
packages("foo.bar.rest");
register(MultiPartFeature.class);
register(JacksonFeature.class);
register(
new LoggingFeature(
java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME),
java.util.logging.Level.INFO,
LoggingFeature.Verbosity.HEADERS_ONLY,
LoggingFeature.DEFAULT_MAX_ENTITY_SIZE)
);
// Initialize SLF4J Bridge here (but works globally) as Jersey logs to JUL
SLF4JBridgeHandler.removeHandlersForRootLogger();
SLF4JBridgeHandler.install();
}
}
Here is my log, first line (bold) is slf4j/logback, seconds is JUL, so the redirect is ok but why JUL is still logging ? is there any way to disable that ? (or do I have to redirect JUL to null or something ?)
2017-06-22 18:28:36.860 INFO o.g.jersey.logging.LoggingFeature - 4 * Server responded with a response on thread http-nio-8080-exec-5 4 < 401 4 < Content-Type: application/json
Jun 22, 2017 6:28:36 PM org.glassfish.jersey.logging.LoggingInterceptor log INFO: 4 * Server responded with a response on thread http-nio-8080-exec-5 4 < 401 4 < Content-Type: application/json