* The as-of date for the currently open log file, or a zero-length
* string if there is no open log file.
*/
- private String date = "";
+ private volatile String date = "";
/**
/**
* Log buffer size
*/
- private int bufferSize = 8192;
+ private int bufferSize = 0;
// --------------------------------------------------------- Public Methods
try {
PrintWriter writer = this.writer;
if (writer!=null) {
- if (bufferSize > 0) {
- writer.write(result);
- } else {
- synchronized (this) {
- // OutputStreamWriter performs buffering inside its StreamEncoder,
- // and so to run without a buffer we have to flush explicitly
- writer.write(result);
- writer.flush();
- }
+ writer.write(result);
+ if (bufferSize < 0) {
+ writer.flush();
}
} else {
reportError("FileHandler is closed or not yet initialized, unable to log ["+result+"]", null, ErrorManager.WRITE_FAILURE);
OutputStream os = bufferSize>0?new BufferedOutputStream(fos,bufferSize):fos;
writer = new PrintWriter(
(encoding != null) ? new OutputStreamWriter(os, encoding)
- : new OutputStreamWriter(os), true);
+ : new OutputStreamWriter(os), false);
writer.write(getFormatter().getHead(this));
} catch (Exception e) {
reportError(null, e, ErrorManager.OPEN_FAILURE);
boolean value.</li>
<li>The root logger can define its set of handlers using a
<code>.handlers</code> property.</li>
- <li>Logging is buffered using a default buffer size of 8192 bytes.
- To change buffersize, use the <code>bufferSize</code> property of a handler.
- The value of <code>0</code> disables buffering.</li>
+ <li>Logging is buffered using a default buffer size of 0 bytes.
+ To change bufferSize, use the <code>bufferSize</code> property of a handler.
+ The value of <code>0</code> uses system default buffering.
+ The value of <code><0</code> forces a writer flush upon each log write.
+ A value <code>>0</code> uses a BufferedOutputStream with the defined value.</li>
<li>System property replacement is performed for property values which
contain ${systemPropertyName}.</li>
</ul>