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();
    }
  }
예제 #2
0
 @Before
 public void before() {
   BasicConfigurator.configure();
   Logger.getRootLogger().setLevel(Level.ERROR);
 }