/**
* loops through the buffer of LoggingEvents, gets a
* sql string from getLogStatement() and sends it to execute().
* Errors are sent to the errorHandler.
*
* If a statement fails the LoggingEvent stays in the buffer!
*/
public void flushBuffer() {
//Do the actual logging
removes.ensureCapacity(buffer.size());
for (Iterator i = buffer.iterator(); i.hasNext();) {
LoggingEvent logEvent = (LoggingEvent)i.next();
try {
String sql = getLogStatement(logEvent);
execute(sql);
}
catch (SQLException e) {
errorHandler.error("Failed to excute sql", e,
ErrorCode.FLUSH_FAILURE);
} finally {
removes.add(logEvent);
}
}
// remove from the buffer any events that were reported
buffer.removeAll(removes);
// clear the buffer of reported events
removes.clear();
}
JDBCAppender.java 文件源码
java
阅读 33
收藏 0
点赞 0
评论 0
项目:daq-eclipse
作者:
评论列表
文章目录