logback-android/src/main/java/ch/qos/logback/core/net/SMTPAppenderBase.java
protected void append(E eventObject) {

    if (!checkEntryConditions()) {
      return;
    }

    String key = discriminator.getDiscriminatingValue(eventObject);
    long now = System.currentTimeMillis();
    final CyclicBuffer<E> cb = cbTracker.getOrCreate(key, now);
    subAppend(cb, eventObject);

    try {
      if (eventEvaluator.evaluate(eventObject)) {
        // clone the CyclicBuffer before sending out asynchronously
        CyclicBuffer<E> cbClone = new CyclicBuffer<E>(cb);
        // see http://jira.qos.ch/browse/LBCLASSIC-221
        cb.clear();

        if (asynchronousSending) {
          // perform actual sending asynchronously
          SenderRunnable senderRunnable = new SenderRunnable(cbClone, eventObject);
          context.getScheduledExecutorService().execute(senderRunnable);
        } else {
          // synchronous sending
          sendBuffer(cbClone, eventObject);
        }
      }
    } catch (EvaluationException ex) {
      errorCount++;
      if (errorCount < CoreConstants.MAX_ERROR_COUNT) {
        addError("SMTPAppender's EventEvaluator threw an Exception-", ex);
      }
    }

    // immediately remove the buffer if asked by the user
    if (eventMarksEndOfLife(eventObject)) {
      cbTracker.endOfLife(key);
    }

    cbTracker.removeStaleComponents(now);

    if (lastTrackerStatusPrint + delayBetweenStatusMessages < now) {
      addInfo("SMTPAppender [" + name + "] is tracking [" + cbTracker.getComponentCount() + "] buffers");
      lastTrackerStatusPrint = now;
      // quadruple 'delay' assuming less than max delay
      if (delayBetweenStatusMessages < MAX_DELAY_BETWEEN_STATUS_MESSAGES) {
        delayBetweenStatusMessages *= 4;
      }
    }
  }
protected void append(E eventObject) {

    if (!checkEntryConditions()) {
      return;
    }

    String key = discriminator.getDiscriminatingValue(eventObject);
    long now = System.currentTimeMillis();
    final CyclicBuffer<E> cb = cbTracker.getOrCreate(key, now);
    subAppend(cb, eventObject);

    try {
      if (eventEvaluator.evaluate(eventObject)) {
        // clone the CyclicBuffer before sending out asynchronously
        CyclicBuffer<E> cbClone = new CyclicBuffer<E>(cb);
        // see http://jira.qos.ch/browse/LBCLASSIC-221
        cb.clear();

        if (asynchronousSending) {
          // perform actual sending asynchronously
          SenderRunnable senderRunnable = new SenderRunnable(cbClone, eventObject);
          context.getScheduledExecutorService().execute(senderRunnable);
        } else {
          // synchronous sending
          sendBuffer(cbClone, eventObject);
        }
      }
    } catch (EvaluationException ex) {
      errorCount++;
      if (errorCount < CoreConstants.MAX_ERROR_COUNT) {
        addError("SMTPAppender's EventEvaluator threw an Exception-", ex);
      }
    }

    // immediately remove the buffer if asked by the user
    if (eventMarksEndOfLife(eventObject)) {
      cbTracker.endOfLife(key);
    }

    cbTracker.removeStaleComponents(now);

    if (lastTrackerStatusPrint + delayBetweenStatusMessages < now) {
      addInfo("SMTPAppender [" + name + "] is tracking [" + cbTracker.getComponentCount() + "] buffers");
      lastTrackerStatusPrint = now;
      // quadruple 'delay' assuming less than max delay
      if (delayBetweenStatusMessages < MAX_DELAY_BETWEEN_STATUS_MESSAGES) {
        delayBetweenStatusMessages *= 4;
      }
    }
  }
protected void append ( E eventObject ) { if ( ! checkEntryConditions ( ) ) { return ; } String key = discriminator . getDiscriminatingValue ( eventObject ) ; long now = System . currentTimeMillis ( ) ; final CyclicBuffer < E > cb = cbTracker . getOrCreate ( key , now ) ; subAppend ( cb , eventObject ) ; try { if ( eventEvaluator . evaluate ( eventObject ) ) { // clone the CyclicBuffer before sending out asynchronously CyclicBuffer < E > cbClone = new CyclicBuffer < E > ( cb ) ; // see http://jira.qos.ch/browse/LBCLASSIC-221 cb . clear ( ) ; if ( asynchronousSending ) { // perform actual sending asynchronously SenderRunnable senderRunnable = new SenderRunnable ( cbClone , eventObject ) ; context . getScheduledExecutorService ( ) . execute ( senderRunnable ) ; } else { // synchronous sending sendBuffer ( cbClone , eventObject ) ; } } } catch ( EvaluationException ex ) { errorCount ++ ; if ( errorCount < CoreConstants . MAX_ERROR_COUNT ) { addError ( "SMTPAppender's EventEvaluator threw an Exception-" , ex ) ; } } // immediately remove the buffer if asked by the user if ( eventMarksEndOfLife ( eventObject ) ) { cbTracker . endOfLife ( key ) ; } cbTracker . removeStaleComponents ( now ) ; if ( lastTrackerStatusPrint + delayBetweenStatusMessages < now ) { addInfo ( "SMTPAppender [" + name + "] is tracking [" + cbTracker . getComponentCount ( ) + "] buffers" ) ; lastTrackerStatusPrint = now ; // quadruple 'delay' assuming less than max delay if ( delayBetweenStatusMessages < MAX_DELAY_BETWEEN_STATUS_MESSAGES ) { delayBetweenStatusMessages *= 4 ; } } }
Perform SMTPAppender specific appending actions, delegating some of them to
a subclass and checking if the event triggers an e-mail to be sent.
Perform SMTPAppender specific appending actions delegating some of them to a subclass and checking if the event triggers an e - mail to be sent .