コード例 #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));
 }
コード例 #2
0
  /** 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);
    }
  }
コード例 #3
0
ファイル: NLogger.java プロジェクト: KiyoungKim/Nabee
 public void callAppenders(LoggingEvent event) {
   super.callAppenders(event);
 }