|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.logging.Handler
org.jboss.logging.jdk.handlers.HandlerSkeleton
org.jboss.logging.jdk.handlers.WriterHandler
public class WriterHandler
A base handler that outputs log messages to a Writer
Field Summary | |
---|---|
protected boolean |
bufferedIO
Do we do bufferedIO? |
protected int |
bufferSize
Determines the size of IO buffer be. |
protected boolean |
immediateFlush
Immediate flush means that the underlying writer or output stream will be flushed at the end of each append operation. |
Fields inherited from class org.jboss.logging.jdk.handlers.HandlerSkeleton |
---|
name |
Constructor Summary | |
---|---|
WriterHandler()
|
|
WriterHandler(OutputStream output,
Formatter formatter)
|
Method Summary | |
---|---|
protected boolean |
checkEntryConditions(LogRecord record)
|
void |
close()
|
void |
flush()
|
int |
getBufferSize()
|
boolean |
getImmediateFlush()
Returns value of the ImmediateFlush option. |
boolean |
isBufferedIO()
|
void |
publish(LogRecord record)
|
void |
setBufferedIO(boolean bufferedIO)
The BufferedIO option takes a boolean value. |
void |
setBufferSize(int bufferSize)
Set the size of the IO buffer. |
void |
setEncoding(String encoding)
|
void |
setImmediateFlush(boolean value)
If the ImmediateFlush option is set to true , the appender will flush at the end of each
write. |
protected void |
setOutputStream(OutputStream out)
Change the output stream. |
protected void |
subPublish(LogRecord record)
Actual writing occurs here. |
Methods inherited from class org.jboss.logging.jdk.handlers.HandlerSkeleton |
---|
activateOptions, debug, getName, setName |
Methods inherited from class java.util.logging.Handler |
---|
getEncoding, getErrorManager, getFilter, getFormatter, getLevel, isLoggable, reportError, setErrorManager, setFilter, setFormatter, setLevel |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected boolean immediateFlush
immediateFlush
is set to
false
, then there is a good chance that the last few
logs events are not actually written to persistent media if and
when the application crashes.
The immediateFlush
variable is set to
true
by default.
protected boolean bufferedIO
protected int bufferSize
Constructor Detail |
---|
public WriterHandler()
public WriterHandler(OutputStream output, Formatter formatter)
Method Detail |
---|
public void setImmediateFlush(boolean value)
true
, the appender will flush at the end of each
write. This is the default behavior. If the option is set to
false
, then the underlying stream can defer writing
to physical medium to a later time.
Avoiding the flush operation at the end of each append results in a performance gain of 10 to 20 percent. However, there is safety tradeoff involved in skipping flushing. Indeed, when flushing is skipped, then it is likely that the last few log events will not be recorded on disk when the application exits. This is a high price to pay even for a 20% performance gain.
public boolean getImmediateFlush()
public boolean isBufferedIO()
public void setBufferedIO(boolean bufferedIO)
false
by default. If true, then File
will be opened and the resulting Writer
wrapped
around a BufferedWriter
.
BufferedIO will significatnly increase performance on heavily
loaded systems.
public int getBufferSize()
public void setBufferSize(int bufferSize)
public void setEncoding(String encoding) throws SecurityException, UnsupportedEncodingException
setEncoding
in class Handler
SecurityException
UnsupportedEncodingException
public void flush()
flush
in class Handler
public void close()
close
in class Handler
public void publish(LogRecord record)
publish
in class Handler
protected boolean checkEntryConditions(LogRecord record)
protected void subPublish(LogRecord record)
protected void setOutputStream(OutputStream out)
out
- New output stream. May not be null.
SecurityException
- if a security manager exists and if
the caller does not have LoggingPermission("control").
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |