@Override
    public Result filter(LogEvent event) {
      if (event.getLevel().equals(Level.INFO) && "SessionState".equals(event.getLoggerName())) {
        if (event.getMessage().getFormattedMessage().startsWith("PREHOOK:")
            || event.getMessage().getFormattedMessage().startsWith("POSTHOOK:")
            || event.getMessage().getFormattedMessage().startsWith("unix_timestamp(void)")
            || event.getMessage().getFormattedMessage().startsWith("Warning: ")
            ) {
          return Result.ACCEPT;
        }
      }
      return Result.DENY;
    }
A log filter that filters test messages coming from the logger.
ql/src/java/org/apache/hadoop/hive/ql/log/LogDivertAppenderForTest.java