JulHandlerPrintStreamAdapterFactory { static PrintStream create(Handler handler, String loggerName, Level messageLevel) { try { return new JulHandlerPrintStream(handler, loggerName, messageLevel); } catch (UnsupportedEncodingException exc) { throw new RuntimeException("Encoding not supported: " + Charsets.UTF_8.name(), exc); } }    }
@Test public void testLogRecordMetadata() { PrintStream printStream = JulHandlerPrintStreamAdapterFactory.create(handler, "fooLogger", Level.WARNING); printStream.println("anyMessage"); assertThat(handler.getLogs(), not(empty())); LogRecord log = Iterables.get(handler.getLogs(), 0); assertThat(log.getLevel(), is(Level.WARNING)); assertThat(log.getLoggerName(), is("fooLogger")); }