1

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

Florian
  • 699
  • 1
  • 5
  • 19
  • 1
    Try printing the [logger tree](https://stackoverflow.com/questions/44882648/logging-not-showing) to see if there is another ConsoleHandler installed. – jmehrens Jul 06 '17 at 20:18
  • @jmehrens thx but truth to be told I've changed that with a custom class implementing JUL and redirecting to slf4j :x – Florian Jul 07 '17 at 12:58

0 Answers0