static {
    new SystemEnvironment().setProperty(GoConstants.USE_COMPRESSED_JAVASCRIPT, "false");
    Logger rootLogger = Logger.getRootLogger();
    rootLogger.setLevel(Level.INFO);
    try {
      Filter filter =
          new Filter() {
            @Override
            public int decide(LoggingEvent loggingEvent) {
              return loggingEvent.getLoggerName().startsWith("com.thoughtworks.go.util.PerfTimer")
                      || loggingEvent
                          .getLoggerName()
                          .startsWith(
                              "com.thoughtworks.go.server.service.PipelineConfigServicePerformanceTest")
                  ? 0
                  : -1;
            }
          };
      ConsoleAppender consoleAppender =
          new ConsoleAppender(new PatternLayout("%d [%p|%c|%C{1}] %m%n"));
      consoleAppender.addFilter(filter);
      consoleAppender.setName(consoleAppenderForPerformanceTest);

      RollingFileAppender rollingFileAppender =
          new RollingFileAppender(
              new PatternLayout("%d [%p|%c|%C{1}] %m%n"), "/tmp/config-save-perf.log", false);
      rollingFileAppender.addFilter(filter);
      rollingFileAppender.setName(rollingFileAppenderForPerformanceTest);
      rootLogger.addAppender(rollingFileAppender);
      rootLogger.addAppender(consoleAppender);
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
Exemplo n.º 2
0
  protected BaseTestCase() {
    TEST_ROOT = "/tmp/cascading_ext_" + this.getClass().getSimpleName() + "_AUTOGEN";

    org.apache.log4j.Logger rootLogger = org.apache.log4j.Logger.getRootLogger();

    rootLogger.setLevel(Level.ALL);
    org.apache.log4j.Logger.getLogger("org.apache.hadoop").setLevel(Level.INFO);
    org.apache.log4j.Logger.getLogger("cascading").setLevel(Level.INFO);
    org.apache.log4j.Logger.getLogger("org.eclipse.jetty").setLevel(Level.ERROR);
    org.apache.log4j.Logger.getLogger("com.liveramp.hank").setLevel(Level.DEBUG);

    // Reconfigure the logger to ensure things are working

    ConsoleAppender consoleAppender =
        new ConsoleAppender(
            new PatternLayout("%d{yy/MM/dd HH:mm:ss} %p %c{2}: %m%n"), ConsoleAppender.SYSTEM_ERR);
    consoleAppender.setName("test-console-appender");
    consoleAppender.setFollow(true);

    rootLogger.removeAppender("test-console-appender");
    rootLogger.addAppender(consoleAppender);
  }