/** * Construct a handler. * * @param handler The handler to copy properties from. * @param formatter The formatter to use. * @throws UnsupportedEncodingException if the encoding is not valid. */ public Stdout(final Handler handler, final Formatter formatter) throws UnsupportedEncodingException { super(System.out, formatter); setErrorManager(handler.getErrorManager()); setFilter(handler.getFilter()); setLevel(handler.getLevel()); setEncoding(handler.getEncoding()); }
/** * Publish a {@link LogRecord} and flush the stream. * * @param record the log record to publish. */ public void publish(final LogRecord record) { super.publish(record); flush(); }
/** * Override {@link StreamHandler#close} to do a flush but not to close the output stream. * That is, we do <b>not</b> close {@link System#out}. */ public void close() { flush(); } }