예제 #1
0
파일: Main.java 프로젝트: Hdzi/emacs
  public void run(String[] args) throws Exception {
    in = System.in;
    out = System.out;
    inReader = new InputStreamReader(in);

    properties = new Properties();
    properties.load(this.getClass().getResourceAsStream("rsense.properties"));

    if (args.length == 0 || args[0].equals("help")) {
      usage();
      return;
    } else if (args[0].equals("version")) {
      version();
      return;
    }

    String command = args[0];
    Options options = parseOptions(args, 1);

    Logger.getInstance().setLevel(options.getLogLevel());
    init(options);
    if (options.getLog() != null) {
      PrintStream log = new PrintStream(new FileOutputStream(options.getLog(), true));
      try {
        Logger.getInstance().setOut(log);
        start(command, options);
      } finally {
        log.close();
      }
    } else {
      start(command, options);
    }
    testResult(options);
  }
예제 #2
0
 private TreeLogger makeCompileLogger(CompileDir compileDir, TreeLogger parent)
     throws UnableToCompleteException {
   try {
     PrintWriterTreeLogger fileLogger = new PrintWriterTreeLogger(compileDir.getLogFile());
     fileLogger.setMaxDetail(options.getLogLevel());
     return new CompositeTreeLogger(parent, fileLogger);
   } catch (IOException e) {
     parent.log(TreeLogger.ERROR, "unable to open log file: " + compileDir.getLogFile(), e);
     throw new UnableToCompleteException();
   }
 }