@Test public void testLogWithResourceBundleWithParameters() { SLF4JBridgeHandler.install(); String resourceBundleName = "org.slf4j.bridge.testLogStrings"; ResourceBundle bundle = ResourceBundle.getBundle(resourceBundleName); java.util.logging.Logger julResourceBundleLogger = java.util.logging.Logger.getLogger("foo", resourceBundleName); String resourceKey1 = "resource_key_1"; String expectedMsg1 = bundle.getString(resourceKey1); julResourceBundleLogger.info(resourceKey1); String resourceKey2 = "resource_key_2"; Object[] params2 = new Object[] { "foo", "bar" }; String expectedMsg2 = MessageFormat.format(bundle.getString(resourceKey2), params2); julResourceBundleLogger.log(Level.INFO, resourceKey2, params2); String resourceKey3 = "invalidKey {0}"; Object[] params3 = new Object[] { "John" }; String expectedMsg3 = MessageFormat.format(resourceKey3, params3); julResourceBundleLogger.log(Level.INFO, resourceKey3, params3); julLogger.log(Level.INFO, resourceKey3, params3); assertEquals(4, listAppender.list.size()); LoggingEvent le = null; le = (LoggingEvent) listAppender.list.get(0); assertEquals("foo", le.getLoggerName()); assertEquals(expectedMsg1, le.getMessage()); le = (LoggingEvent) listAppender.list.get(1); assertEquals("foo", le.getLoggerName()); assertEquals(expectedMsg2, le.getMessage()); le = (LoggingEvent) listAppender.list.get(2); assertEquals("foo", le.getLoggerName()); assertEquals(expectedMsg3, le.getMessage()); le = (LoggingEvent) listAppender.list.get(3); assertEquals("yay", le.getLoggerName()); assertEquals(expectedMsg3, le.getMessage()); }
public static void install() { LogManager.getLogManager().getLogger("").addHandler(new SLF4JBridgeHandler()); }
SLF4JBridgeHandler extends Handler { public static void install() { LogManager.getLogManager().getLogger("").addHandler(new SLF4JBridgeHandler()); } }
SLF4JBridgeHandler extends Handler { public static void install() { LogManager.getLogManager().getLogger("").addHandler(new SLF4JBridgeHandler()); } SLF4JBridgeHandler(); }
SLF4JBridgeHandler extends Handler { public static void install() { LogManager.getLogManager().getLogger("").addHandler(new SLF4JBridgeHandler()); } SLF4JBridgeHandler(); static void install(); static void uninstall(); static boolean isInstalled(); static void removeHandlersForRootLogger(); void close(); void flush(); void publish(LogRecord record); }
SLF4JBridgeHandler extends Handler { public static void install() { LogManager.getLogManager().getLogger("").addHandler(new SLF4JBridgeHandler()); } SLF4JBridgeHandler(); static void install(); static void uninstall(); static boolean isInstalled(); static void removeHandlersForRootLogger(); void close(); void flush(); void publish(LogRecord record);  }