コード例 #1
0
 private void enqueueLogMessageInfo(Info info) {
   // LOG4J2-639: catch NPE if disruptor field was set to null after our check above
   try {
     // Note: do NOT use the temp variable above!
     // That could result in adding a log event to the disruptor after it was shut down,
     // which could cause the publishEvent method to hang and never return.
     disruptor.publishEvent(info.translator);
   } catch (final NullPointerException npe) {
     LOGGER.fatal("Ignoring log event after log4j was shut down.");
   }
 }
コード例 #2
0
  @Override
  public void logMessage(
      final String fqcn,
      final Level level,
      final Marker marker,
      final Message message,
      final Throwable thrown) {

    final Disruptor<RingBufferLogEvent> temp = disruptor;
    if (temp == null) { // LOG4J2-639
      LOGGER.fatal("Ignoring log event after log4j was shut down");
    } else {
      logMessage0(temp, fqcn, level, marker, message, thrown);
    }
  }