public class WriterHandler extends ExtHandler
Writer
.Modifier and Type | Field and Description |
---|---|
protected java.lang.Object |
outputLock |
private java.io.Writer |
writer |
handlers, handlersUpdater
Constructor and Description |
---|
WriterHandler() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close this logger.
|
protected void |
doPublish(ExtLogRecord record)
Do the actual work of publication; the record will have been filtered already.
|
void |
flush()
Flush this logger.
|
protected void |
preWrite(ExtLogRecord record)
Execute any pre-write policy, such as file rotation.
|
protected void |
safeClose(java.io.Closeable c)
Safely close the resource, reporting an error if the close fails.
|
private void |
safeFlush(java.io.Flushable f) |
void |
setWriter(java.io.Writer writer)
Set the writer.
|
private void |
writeHead(java.io.Writer writer) |
private void |
writeTail(java.io.Writer writer) |
addHandler, checkAccess, checkAccess, clearHandlers, disableAccess, enableAccess, getHandlers, isAutoFlush, isEnabled, protect, publish, publish, removeHandler, setAutoFlush, setEnabled, setEncoding, setErrorManager, setFilter, setFormatter, setHandlers, setLevel, unprotect
protected final java.lang.Object outputLock
private java.io.Writer writer
protected void doPublish(ExtLogRecord record)
autoFlush
property is set to true
; if this behavior is to be
preserved in a subclass then this method should be called after the record is physically written.doPublish
in class ExtHandler
record
- the log record to publishprotected void preWrite(ExtLogRecord record)
record
- the record about to be loggedpublic void setWriter(java.io.Writer writer)
writer
- the new writer, or null
to disable loggingprivate void writeHead(java.io.Writer writer)
private void writeTail(java.io.Writer writer)
public void flush()
flush
in interface java.io.Flushable
flush
in class ExtHandler
public void close() throws java.lang.SecurityException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class ExtHandler
java.lang.SecurityException
- if the caller does not have sufficient permissionprotected void safeClose(java.io.Closeable c)
c
- the resourceprivate void safeFlush(java.io.Flushable f)