code: private void flushBuffer() {
  		// Do the actual logging:
  		removes.ensureCapacity(buffer.size());
  		for(Iterator<LoggingEvent> i = buffer.iterator(); i.hasNext();) {
  			try {
  				LoggingEvent event = (LoggingEvent)i.next();
  				doLog(event);
  				removes.add(event);
  			} catch(Exception e) {
  				errorHandler.error("Failed to flush log", e, ErrorCode.FLUSH_FAILURE);
  			}
  		}
  
  		// Remove from the buffer any events that were reported:
  		buffer.removeAll(removes);
  
  		// Clear the buffer of reported events:
  		removes.clear();
  	}
docs: --------------------------------------------------------------------------