@Override
  protected void append(LoggingEvent loggingEvent) {

    try {
      // if an event with a non-null throwable is received => exception event
      if (loggingEvent.getThrowableInformation() != null) {
        DiagnosticsExceptionEvent diagnosticsExceptionEvent =
            new DiagnosticsExceptionEvent(loggingEvent.timeStamp, loggingEvent.getThrowableInformation().getThrowable(),
                loggingEvent.getProperties());

        diagnosticsManager.addExceptionEvent(diagnosticsExceptionEvent);
      }
    } catch (Exception e) {
      // blanket catch of all exceptions so as to not impact any job
      System.err.println("Exception in logging event parsing " + e);
    }
  }
A simple log4j1.2.* appender, which attaches itself to the root logger.
Attachment to the root logger is thread safe.
samza-log4j/src/main/java/org/apache/samza/logging/log4j/SimpleDiagnosticsAppender.java