Slf4jLogger extends feign.Logger { @Override protected void log(String configKey, String format, Object... args) { if (logger.isDebugEnabled()) { logger.debug(String.format(methodTag(configKey) + format, args)); } } Slf4jLogger();  Slf4jLogger(Class<?> clazz);  Slf4jLogger(String name);   Slf4jLogger(Logger logger);   }
@Test public void useFeignLoggerByDefault() throws Exception { slf4j.logLevel("debug"); slf4j.expectMessages( "DEBUG feign.Logger - [someMethod] This is my message" + System.lineSeparator()); logger = new Slf4jLogger(); logger.log(CONFIG_KEY, "This is my message"); }
@Test public void useLoggerByNameIfRequested() throws Exception { slf4j.logLevel("debug"); slf4j.expectMessages( "DEBUG named.logger - [someMethod] This is my message" + System.lineSeparator()); logger = new Slf4jLogger("named.logger"); logger.log(CONFIG_KEY, "This is my message"); }
@Test public void useLoggerByClassIfRequested() throws Exception { slf4j.logLevel("debug"); slf4j.expectMessages( "DEBUG feign.Feign - [someMethod] This is my message" + System.lineSeparator()); logger = new Slf4jLogger(Feign.class); logger.log(CONFIG_KEY, "This is my message"); }
@Test public void useSpecifiedLoggerIfRequested() throws Exception { slf4j.logLevel("debug"); slf4j.expectMessages( "DEBUG specified.logger - [someMethod] This is my message" + System.lineSeparator()); logger = new Slf4jLogger(LoggerFactory.getLogger("specified.logger")); logger.log(CONFIG_KEY, "This is my message"); }