ch.qos.logback.classic.Logger.callAppenders()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(223)

本文整理了Java中ch.qos.logback.classic.Logger.callAppenders()方法的一些代码示例,展示了Logger.callAppenders()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger.callAppenders()方法的具体详情如下:
包路径:ch.qos.logback.classic.Logger
类名称:Logger
方法名:callAppenders

Logger.callAppenders介绍

[英]Invoke all the appenders of this logger.
[中]调用此记录器的所有附加程序。

代码示例

代码示例来源:origin: ch.qos.logback/logback-classic

private void buildLoggingEventAndAppend(final String localFQCN, final Marker marker, final Level level, final String msg, final Object[] params,
        final Throwable t) {
  LoggingEvent le = new LoggingEvent(localFQCN, this, level, msg, t, params);
  le.setMarker(marker);
  callAppenders(le);
}

代码示例来源:origin: ch.qos.logback/logback-classic

private void dispatchEvents(LoggerContext lc) {
  ObjectInputStream ois = null;
  try {
    socket.setSoTimeout(acceptConnectionTimeout);
    ois = new HardenedLoggingEventInputStream(socket.getInputStream());
    socket.setSoTimeout(0);
    addInfo(receiverId + "connection established");
    while (true) {
      ILoggingEvent event = (ILoggingEvent) ois.readObject();
      Logger remoteLogger = lc.getLogger(event.getLoggerName());
      if (remoteLogger.isEnabledFor(event.getLevel())) {
        remoteLogger.callAppenders(event);
      }
    }
  } catch (EOFException ex) {
    addInfo(receiverId + "end-of-stream detected");
  } catch (IOException ex) {
    addInfo(receiverId + "connection failed: " + ex);
  } catch (ClassNotFoundException ex) {
    addInfo(receiverId + "unknown event class: " + ex);
  } finally {
    CloseUtil.closeQuietly(ois);
    CloseUtil.closeQuietly(socket);
    socket = null;
    addInfo(receiverId + "connection closed");
  }
}

代码示例来源:origin: ch.qos.logback/logback-classic

remoteLogger.callAppenders(event);

代码示例来源:origin: ch.qos.logback/logback-classic

remoteLogger.callAppenders(event);

代码示例来源:origin: camunda/camunda-bpm-platform

private void buildLoggingEventAndAppend(final String localFQCN,
  final Marker marker, final Level level, final String msg,
  final Object[] params, final Throwable t) {
 LoggingEvent le = new LoggingEvent(localFQCN, this, level, msg, t, params);
 le.setMarker(marker);
 callAppenders(le);
}

代码示例来源:origin: camunda/camunda-bpm-platform

public void onMessage(javax.jms.Message message) {
 ILoggingEvent event;
 try {
  if (message instanceof ObjectMessage) {
   ObjectMessage objectMessage = (ObjectMessage) message;
   event = (ILoggingEvent) objectMessage.getObject();
   Logger log = (Logger) LoggerFactory.getLogger(event.getLoggerName());
   log.callAppenders(event);
  } else {
   logger.warn("Received message is of type " + message.getJMSType()
     + ", was expecting ObjectMessage.");
  }
 } catch (JMSException jmse) {
  logger.error("Exception thrown while processing incoming message.", jmse);
 }
}

代码示例来源:origin: camunda/camunda-bpm-platform

public void onMessage(javax.jms.Message message) {
 ILoggingEvent event;
 try {
  if (message instanceof ObjectMessage) {
   ObjectMessage objectMessage = (ObjectMessage) message;
   event = (ILoggingEvent) objectMessage.getObject();
   Logger log = (Logger) LoggerFactory.getLogger(event.getLoggerName());
   log.callAppenders(event);
  } else {
   logger.warn("Received message is of type " + message.getJMSType()
     + ", was expecting ObjectMessage.");
  }
 } catch (JMSException jmse) {
  logger.error("Exception thrown while processing incoming message.", jmse);
 }
}

代码示例来源:origin: camunda/camunda-bpm-platform

private void dispatchEvents(LoggerContext lc) {
 try {
  socket.setSoTimeout(acceptConnectionTimeout);
  ObjectInputStream ois = new ObjectInputStream(socket.getInputStream());
  socket.setSoTimeout(0);
  addInfo(receiverId + "connection established");
  while (true) {
   ILoggingEvent event = (ILoggingEvent) ois.readObject();
   Logger remoteLogger = lc.getLogger(event.getLoggerName());
   if (remoteLogger.isEnabledFor(event.getLevel())) {
    remoteLogger.callAppenders(event);
   }
  }
 } catch (EOFException ex) {
  addInfo(receiverId + "end-of-stream detected");
 } catch (IOException ex) {
  addInfo(receiverId + "connection failed: " + ex);
 } catch (ClassNotFoundException ex) {
  addInfo(receiverId + "unknown event class: " + ex);
 } finally {
  CloseUtil.closeQuietly(socket);
  socket = null;
  addInfo(receiverId + "connection closed");
 }
}

代码示例来源:origin: camunda/camunda-bpm-platform

remoteLogger.callAppenders(event);

代码示例来源:origin: com.opentable.components/otj-logging

/**
   * Log an arbitrary {@link ILoggingEvent} to a Logback logger.
   * @param logger the logger to log to
   * @param event the event to log
   */
  public static void log(Logger logger, ILoggingEvent event)
  {
    ((ch.qos.logback.classic.Logger) logger).callAppenders(event);
  }
}

代码示例来源:origin: camunda/camunda-bpm-platform

remoteLogger.callAppenders(event);

代码示例来源:origin: caskdata/cdap

@Override
 public void onLog(LogEntry entry) {
  log.callAppenders(new TwillLogEntryAdapter(entry));
 }
};

代码示例来源:origin: co.cask.cdap/cdap-common

@Override
 public void onLog(LogEntry entry) {
  log.callAppenders(new TwillLogEntryAdapter(entry));
 }
};

代码示例来源:origin: tony19/logback-android

private void buildLoggingEventAndAppend(final String localFQCN,
  final Marker marker, final Level level, final String msg,
  final Object[] params, final Throwable t) {
 LoggingEvent le = new LoggingEvent(localFQCN, this, level, msg, t, params);
 le.setMarker(marker);
 callAppenders(le);
}

代码示例来源:origin: com.alibaba.citrus.tool/antx-autoexpand

private void buildLoggingEventAndAppend(final String localFQCN,
  final Marker marker, final Level level, final String msg,
  final Object[] params, final Throwable t) {
 LoggingEvent le = new LoggingEvent(localFQCN, this, level, msg, t, params);
 le.setMarker(marker);
 callAppenders(le);
}

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

private void buildLoggingEventAndAppend(final String localFQCN, final Marker marker, final Level level, final String msg, final Object[] params,
        final Throwable t) {
  LoggingEvent le = new LoggingEvent(localFQCN, this, level, msg, t, params);
  le.setMarker(marker);
  callAppenders(le);
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

private void buildLoggingEventAndAppend(final String localFQCN, final Marker marker, final Level level, final String msg, final Object[] params,
        final Throwable t) {
  LoggingEvent le = new LoggingEvent(localFQCN, this, level, msg, t, params);
  le.setMarker(marker);
  callAppenders(le);
}

代码示例来源:origin: Nextdoor/bender

private void buildLoggingEventAndAppend(final String localFQCN, final Marker marker, final Level level, final String msg, final Object[] params,
        final Throwable t) {
  LoggingEvent le = new LoggingEvent(localFQCN, this, level, msg, t, params);
  le.setMarker(marker);
  callAppenders(le);
}

代码示例来源:origin: caskdata/cdap

private void callAppenders(ILoggingEvent event) {
 if (event == SHUTDOWN_EVENT) {
  return;
 }
 Logger logger = context.getEffectiveLogger(event.getLoggerName());
 try {
  logger.callAppenders(event);
 } catch (Throwable t) {
  addError("Exception raised when appending to logger " + logger.getName() +
        " with message " + event.getFormattedMessage(), t);
 }
}

代码示例来源:origin: co.cask.cdap/cdap-watchdog

private void callAppenders(ILoggingEvent event) {
 if (event == SHUTDOWN_EVENT) {
  return;
 }
 Logger logger = context.getEffectiveLogger(event.getLoggerName());
 try {
  logger.callAppenders(event);
 } catch (Throwable t) {
  addError("Exception raised when appending to logger " + logger.getName() +
        " with message " + event.getFormattedMessage(), t);
 }
}

相关文章