There is a way to find out.
Here's the example how you can configure LOGBack
// Here we create context LoggerContext loggerContext = new LoggerContext(); // Initializer is used to enrich context with details ContextInitializer contextInitializer = new ContextInitializer(loggerContext); try { // Get a configuration file from classpath URL configurationUrl = Thread.currentThread().getContextClassLoader().getResource("custom-logback-configuration.xml"); if (configurationUrl == null) { throw new IllegalStateException("Unable to find custom logback configuration file"); } // Ask context initializer to load configuration into context contextInitializer.configureByResource(configurationUrl); // Here we get logger from context logger = loggerContext.getLogger(LogReporter.class); } catch (JoranException e) { throw new RuntimeException("Unable to configure logger", e); }
In general if you want to know how any SLF4J backend works, you may just to look at org.slf4j.impl.StaticLoggerBinder class source from that backend.