private synchronized void flushAndClose() throws SecurityException { if (writer != null) { try { if (!doneHeader) { writer.write(getFormatter().getHead(this)); doneHeader = true; } writer.write(getFormatter().getTail(this)); writer.flush(); writer.close(); } catch (Exception ex) { // We don't want to throw an exception here, but we // report the exception to any registered ErrorManager. reportError(null, ex, ErrorManager.CLOSE_FAILURE); } writer = null; } }
private void initializeWriter() { this.writerNotInitialized = false; if (getEncoding() == null) { this.writer = new OutputStreamWriter(this.os); } else { try { this.writer = new OutputStreamWriter(this.os, getEncoding()); } catch (UnsupportedEncodingException e) { /* * Should not happen because it's checked in * super.initProperties(). */ } } write(getFormatter().getHead(this)); }
public synchronized void publish(final LogRecord record) { if (!isLoggable(record)) { return; } String msg; try { msg = getFormatter().format(record); } catch (Exception ex) { // We don't want to throw an exception here, but we // report the exception to any registered ErrorManager. reportError(null, ex, ErrorManager.FORMAT_FAILURE); return; } try { if (!doneHeader) { writer.write(getFormatter().getHead(this)); doneHeader = true; } writer.write(msg); } catch (Exception ex) { // We don't want to throw an exception here, but we // report the exception to any registered ErrorManager. reportError(null, ex, ErrorManager.WRITE_FAILURE); } }
/** * Creates the head or reports a formatting error. * @param f the formatter. * @return the head string or an empty string. */ private String head(final Formatter f) { try { return f.getHead(this); } catch (final RuntimeException RE) { reportError(RE.getMessage(), RE, ErrorManager.FORMAT_FAILURE); return ""; } }
/** * Creates the head or reports a formatting error. * @param f the formatter. * @return the head string or an empty string. */ private String head(final Formatter f) { try { return f.getHead(this); } catch (final RuntimeException RE) { reportError(RE.getMessage(), RE, ErrorManager.FORMAT_FAILURE); return ""; } }
(encoding != null) ? new OutputStreamWriter(os, encoding) : new OutputStreamWriter(os), false); writer.write(getFormatter().getHead(this)); } catch (Exception e) { reportError(null, e, ErrorManager.OPEN_FAILURE);
if (f != null) { synchronized (f) { head = f.getHead(h); msg = record != null ? f.format(record) : ""; tail = f.getTail(h);
if (f != null) { synchronized (f) { head = f.getHead(h); msg = record != null ? f.format(record) : ""; tail = f.getTail(h);
/** * Return the header string for a set of formatted records. * * @param h PARAM * @return The head value */ public String getHead( Handler h ) { return super.getHead( h ); }
/** * Return the header string for a set of formatted records. * * @param h PARAM * @return The head value */ public String getHead( Handler h ) { return super.getHead( h ); }
/** * Return the header string for a set of formatted records. * * @param h PARAM * @return The head value */ public String getHead( Handler h ) { return super.getHead( h ); }
/** * Return the header string for a set of formatted records. * * @param h PARAM * @return The head value */ public String getHead( Handler h ) { return super.getHead( h ); }
private String head(final Formatter f) { try { return f.getHead(this); } catch (final RuntimeException RE) { reportError(RE.getMessage(), RE, ErrorManager.FORMAT_FAILURE); return ""; } }
private void doHeaders() { if (!doneHeader) { String head = getFormatter().getHead(this); out.append(head); err.append(head); doneHeader = true; } }
/** * Creates the head or reports a formatting error. * @param f the formatter. * @return the head string or an empty string. */ private String head(final Formatter f) { try { return f.getHead(this); } catch (final RuntimeException RE) { reportError(RE.getMessage(), RE, ErrorManager.FORMAT_FAILURE); return ""; } }
/** * Creates the head or reports a formatting error. * @param f the formatter. * @return the head string or an empty string. */ private String head(final Formatter f) { try { return f.getHead(this); } catch (final RuntimeException RE) { reportError(RE.getMessage(), RE, ErrorManager.FORMAT_FAILURE); return ""; } }
/** * Creates the head or reports a formatting error. * @param f the formatter. * @return the head string or an empty string. */ private String head(final Formatter f) { try { return f.getHead(this); } catch (final RuntimeException RE) { reportError(RE.getMessage(), RE, ErrorManager.FORMAT_FAILURE); return ""; } }
private void writeHead(final Writer writer) { try { final Formatter formatter = getFormatter(); if (formatter != null) writer.write(formatter.getHead(this)); } catch (Exception e) { reportError("Error writing section header", e, ErrorManager.WRITE_FAILURE); } }
private void writeHead(final Writer writer) { try { final Formatter formatter = getFormatter(); if (formatter != null) writer.write(formatter.getHead(this)); } catch (Exception e) { reportError("Error writing section header", e, ErrorManager.WRITE_FAILURE); } }
private void initializeWriter() { this.writerNotInitialized = false; if (getEncoding() == null) { this.writer = new OutputStreamWriter(this.os); } else { try { this.writer = new OutputStreamWriter(this.os, getEncoding()); } catch (UnsupportedEncodingException e) { } } write(getFormatter().getHead(this)); }