public void publish(LogRecord record) { if(checkEntryConditions(record) == false) { return; } subPublish(record); }
public synchronized void flush() { if (msgWriter != null) { try { msgWriter.flush(); } catch (IOException e) { reportError("Failed to flush writer", e, ErrorManager.FLUSH_FAILURE); } } }
public WriterHandler(OutputStream output, Formatter formatter) { setFormatter(formatter); setOutputStream(output); }
/** * Actual writing occurs here. * Most subclasses of WriterHandler will need to * override this method. */ protected void subPublish(LogRecord record) { Formatter fmt = getFormatter(); String msg = fmt.format(record); synchronized (this) { try { msgWriter.write(msg); } catch (IOException e) { reportError("Failed to publish recored", e, ErrorManager.WRITE_FAILURE); } if (this.immediateFlush) { flush(); } } }
super.setBufferedIO(bufferedIO); super.setBufferSize(bufferSize); FileOutputStream ostream = null; try super.setOutputStream(ostream); this.fileName = fileName; this.fileAppend = append;
public synchronized void close() { if (msgWriter != null) { try { if (!wroteHeader) { msgWriter.write(getFormatter().getHead(this)); wroteHeader = true; } msgWriter.write(getFormatter().getTail(this)); msgWriter.flush(); msgWriter.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); } msgWriter = null; msgOutput = null; } }
close(); msgOutput = out; wroteHeader = false; String encoding = getEncoding(); if (encoding == null)
public void setEncoding(String encoding) throws SecurityException, UnsupportedEncodingException { super.setEncoding(encoding); if (msgOutput == null) { return; } // Replace the current writer with a writer for the new encoding. flush(); if (encoding == null) { msgWriter = new OutputStreamWriter(msgOutput); } else { msgWriter = new OutputStreamWriter(msgOutput, encoding); } }
/** * Instantiate a <code>FileHandler</code> and open the file * designated by <code>filename</code>. The opened filename will * become the output destination for this appender. * <p/> * <p>If the <code>append</code> parameter is true, the file will be * appended to. Otherwise, the file designated by * <code>filename</code> will be truncated before being opened. * <p/> * <p>If the <code>bufferedIO</code> parameter is <code>true</code>, * then buffered IO will be used to write to the output file. */ public FileHandler(Formatter layout, String filename, boolean append, boolean bufferedIO, int bufferSize) throws IOException { super.setFormatter(layout); this.setFile(filename, append, bufferedIO, bufferSize); }
/** * Actual writing occurs here. * Most subclasses of WriterHandler will need to * override this method. */ protected void subPublish(LogRecord record) { Formatter fmt = getFormatter(); String msg = fmt.format(record); synchronized (this) { try { msgWriter.write(msg); } catch (IOException e) { reportError("Failed to publish recored", e, ErrorManager.WRITE_FAILURE); } if (this.immediateFlush) { flush(); } } }
super.setBufferedIO(bufferedIO); super.setBufferSize(bufferSize); FileOutputStream ostream = null; try super.setOutputStream(ostream); this.fileName = fileName; this.fileAppend = append;
public synchronized void close() { if (msgWriter != null) { try { if (!wroteHeader) { msgWriter.write(getFormatter().getHead(this)); wroteHeader = true; } msgWriter.write(getFormatter().getTail(this)); msgWriter.flush(); msgWriter.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); } msgWriter = null; msgOutput = null; } }
close(); msgOutput = out; wroteHeader = false; String encoding = getEncoding(); if (encoding == null)
public void setEncoding(String encoding) throws SecurityException, UnsupportedEncodingException { super.setEncoding(encoding); if (msgOutput == null) { return; } // Replace the current writer with a writer for the new encoding. flush(); if (encoding == null) { msgWriter = new OutputStreamWriter(msgOutput); } else { msgWriter = new OutputStreamWriter(msgOutput, encoding); } }
/** * Instantiate a <code>FileHandler</code> and open the file * designated by <code>filename</code>. The opened filename will * become the output destination for this appender. * <p/> * <p>If the <code>append</code> parameter is true, the file will be * appended to. Otherwise, the file designated by * <code>filename</code> will be truncated before being opened. * <p/> * <p>If the <code>bufferedIO</code> parameter is <code>true</code>, * then buffered IO will be used to write to the output file. */ public FileHandler(Formatter layout, String filename, boolean append, boolean bufferedIO, int bufferSize) throws IOException { super.setFormatter(layout); this.setFile(filename, append, bufferedIO, bufferSize); }
/** * Actual writing occurs here. * Most subclasses of WriterHandler will need to * override this method. * @param record */ protected void subPublish(LogRecord record) { Formatter fmt = getFormatter(); String msg = fmt.format(record); synchronized (this) { try { msgWriter.write(msg); } catch (IOException e) { reportError("Failed to publish recored", e, ErrorManager.WRITE_FAILURE); } if (this.immediateFlush) { flush(); } } }
super.setBufferedIO(bufferedIO); super.setBufferSize(bufferSize); FileOutputStream ostream = null; try super.setOutputStream(ostream); this.fileName = fileName; this.fileAppend = append;
public WriterHandler(OutputStream output, Formatter formatter) { setFormatter(formatter); setOutputStream(output); }
public void publish(LogRecord record) { if(checkEntryConditions(record) == false) { return; } subPublish(record); }
public synchronized void close() { if (msgWriter != null) { try { if (!wroteHeader) { msgWriter.write(getFormatter().getHead(this)); wroteHeader = true; } msgWriter.write(getFormatter().getTail(this)); msgWriter.flush(); msgWriter.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); } msgWriter = null; msgOutput = null; } }