private void attachAppenderToRootLogger() {
    // ensure appender is attached only once per JVM (regardless of #containers)
    if (org.apache.log4j.Logger.getRootLogger().getAppender(SimpleDiagnosticsAppender.class.getName()) == null) {
      System.out.println("Attaching diagnostics appender to root logger");
      org.apache.log4j.Logger.getRootLogger().addAppender(this);
    }
  }
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