Example #1
0
 @Override
 public void log(LogEvent logEvent) {
   LogRecord logRecord = logEvent.getLogRecord();
   if (logRecord.getLevel() == Level.OFF) {
     return;
   }
   String name = logEvent.getLogRecord().getLoggerName();
   org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(name);
   org.apache.log4j.Level level = toLog4jLevel(logRecord.getLevel());
   String message = logRecord.getMessage();
   Throwable throwable = logRecord.getThrown();
   logger.callAppenders(new LoggingEvent(name, logger, level, message, throwable));
 }
  /** Flushes the buffer to the {@link Logger} named <code>delegateLoggerName</code> */
  public void dump() {
    Logger delegate = Logger.getLogger(delegateLoggerName);
    // copy buffer contents and dump
    Collection<LoggingEvent> sink;

    synchronized (bufferLock) {
      sink = new LinkedList<LoggingEvent>(buffer);
      buffer.clear();
    }

    for (LoggingEvent e : sink) {
      delegate.callAppenders(e);
    }
  }
Example #3
0
 public void callAppenders(LoggingEvent event) {
   super.callAppenders(event);
 }