src/share/classes/java/util/logging/StreamHandler.java

Print this page

        

*** 71,84 **** * <p> * @since 1.4 */ public class StreamHandler extends Handler { - private LogManager manager = LogManager.getLogManager(); private OutputStream output; private boolean doneHeader; ! private Writer writer; // Private method to configure a StreamHandler from LogManager // properties and/or default values as specified in the class // javadoc. private void configure() { --- 71,83 ---- * <p> * @since 1.4 */ public class StreamHandler extends Handler { private OutputStream output; private boolean doneHeader; ! private volatile Writer writer; // Private method to configure a StreamHandler from LogManager // properties and/or default values as specified in the class // javadoc. private void configure() {
*** 167,177 **** * @exception SecurityException if a security manager exists and if * the caller does not have <tt>LoggingPermission("control")</tt>. * @exception UnsupportedEncodingException if the named encoding is * not supported. */ ! public void setEncoding(String encoding) throws SecurityException, java.io.UnsupportedEncodingException { super.setEncoding(encoding); if (output == null) { return; } --- 166,177 ---- * @exception SecurityException if a security manager exists and if * the caller does not have <tt>LoggingPermission("control")</tt>. * @exception UnsupportedEncodingException if the named encoding is * not supported. */ ! @Override ! public synchronized void setEncoding(String encoding) throws SecurityException, java.io.UnsupportedEncodingException { super.setEncoding(encoding); if (output == null) { return; }
*** 199,208 **** --- 199,209 ---- * written to the stream before the <tt>LogRecord</tt> is written. * * @param record description of the log event. A null record is * silently ignored and is not published */ + @Override public synchronized void publish(LogRecord record) { if (!isLoggable(record)) { return; } String msg;
*** 238,257 **** --- 239,260 ---- * <p> * @param record a <tt>LogRecord</tt> * @return true if the <tt>LogRecord</tt> would be logged. * */ + @Override public boolean isLoggable(LogRecord record) { if (writer == null || record == null) { return false; } return super.isLoggable(record); } /** * Flush any buffered messages. */ + @Override public synchronized void flush() { if (writer != null) { try { writer.flush(); } catch (Exception ex) {
*** 292,300 **** --- 295,304 ---- * "tail" string. * * @exception SecurityException if a security manager exists and if * the caller does not have LoggingPermission("control"). */ + @Override public synchronized void close() throws SecurityException { flushAndClose(); } }