Slf4jLoggerFactory implements WebBeansLoggerFactory { @Override public Logger getLogger(final Class<?> clazz, final Locale desiredLocale) { return new Slf4jLogger(clazz.getName(), ResourceBundle.getBundle("openwebbeans/Messages", desiredLocale).toString()); }  @Override Logger getLogger(final Class<?> clazz, final Locale desiredLocale); @Override Logger getLogger(final Class<?> clazz);  }
@Test public void ensureLogGoesOnSlf4j() { final Logger logger = WebBeansLoggerFacade.getLogger(Slf4jLoggerFactoryTest.class); assertTrue(logger.getClass().getName(), Slf4jLogger.class.isInstance(logger)); final PrintStream original = System.err; final ByteArrayOutputStream buffer = new ByteArrayOutputStream(); System.setErr(new PrintStream(new OutputStream() { @Override public void write(final int b) { buffer.write(b); original.write(b); } @Override public void write(final byte[] b) throws IOException { buffer.write(b); original.write(b); } @Override public void write(final byte[] b, final int off, final int len) { buffer.write(b, off, len); original.write(b, off, len); } })); try { logger.info("test log"); } finally { System.setErr(original); } assertEquals( "[main] INFO " + getClass().getName() + " - test log\n", new String(buffer.toByteArray(), StandardCharsets.UTF_8)); }