@Override
  public void close() {
    log.info("Shutting down the StreamAppender...");
    if (!this.closed) {
      this.closed = true;
      transferThread.interrupt();
      try {
        transferThread.join();
      } catch (InterruptedException e) {
        log.error("Interrupted while waiting for transfer thread to finish.", e);
        Thread.currentThread().interrupt();
      }

      flushSystemProducer();
      if (systemProducer !=  null) {
        systemProducer.stop();
      }
    }
  }
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