public final void write(final String string) {
if (string == null) {
/*
* Create an exception here so that a stack trace is available for
* debugging purposes.
*/
errorHandler.error("Attempt to write null - see Log4J bug list.",
new RuntimeException("Fault in Log4J Layout"),
ErrorCode.WRITE_FAILURE);
return;
}
try {
synchronized (lock) {
final int length = string.length();
out.write(string, 0, length);
this.charCount += length;
}
} catch (IOException e) {
if (e instanceof InterruptedIOException) {
Thread.currentThread().interrupt();
}
errorHandler.error("Failed to write [" + string + "].", e,
ErrorCode.WRITE_FAILURE);
}
}
SynchronizedCountingQuietWriter.java 文件源码
java
阅读 21
收藏 0
点赞 0
评论 0
项目:logging
作者:
评论列表
文章目录