@Override
  public void append(LoggingEvent event) {
    if (!recursiveCall.get()) {
      try {
        recursiveCall.set(true);
        if (!systemInitialized) {
          // configs are needed to set up producer system, so check that before actually initializing
          if (readyToInitialize()) {
            synchronized (this) {
              if (!systemInitialized) {
                setupSystem();
                systemInitialized = true;
              }
            }
            handleEvent(event);
          } else {
            // skip sending the log to the stream if initialization can't happen yet
            log.trace("Waiting for config to become available before log can be handled");
          }
        } else {
          handleEvent(event);
        }
      } catch (Exception e) {
        System.err.println("[StreamAppender] Error sending log message:");
        e.printStackTrace();
      } finally {
        recursiveCall.set(false);
      }
    } else if (metrics != null) { // setupSystem() may not have been invoked yet so metrics can be null here.
      metrics.recursiveCalls.inc();
    }
  }
Additional configurations needed before logging to stream. Called once in the container before the first log event is sent.
samza-log4j/src/main/java/org/apache/samza/logging/log4j/StreamAppender.java