public EquinoxLogServices(EquinoxConfiguration environmentInfo, Location configuration) {
    String logFilePath = environmentInfo.getConfiguration(EclipseStarter.PROP_LOGFILE);
    if (logFilePath == null) {
      logFilePath = Long.toString(System.currentTimeMillis()) + EquinoxLogServices.LOG_EXT;
    }

    File logFile = new File(logFilePath);
    if (!logFile.isAbsolute()) {
      File configAreaDirectory = null;
      if (configuration != null)
        // TODO assumes the URL is a file: url
        configAreaDirectory = new File(configuration.getURL().getFile());

      if (configAreaDirectory != null) {
        logFile = new File(configAreaDirectory, logFilePath);
      } else {
        logFile = null;
      }
    }

    boolean enabled =
        "true"
            .equals(
                environmentInfo.getConfiguration(
                    PROP_LOG_ENABLED, "true")); // $NON-NLS-1$ //$NON-NLS-2$
    if (logFile != null) {
      environmentInfo.setConfiguration(EclipseStarter.PROP_LOGFILE, logFile.getAbsolutePath());
      logWriter = new EquinoxLogWriter(logFile, EQUINOX_LOGGER_NAME, enabled, environmentInfo);

      File perfLogFile = new File(logFile.getParentFile(), "performance.log"); // $NON-NLS-1$
      perfWriter = new EquinoxLogWriter(perfLogFile, PERF_LOGGER_NAME, true, environmentInfo);
    } else {
      logWriter =
          new EquinoxLogWriter((Writer) null, EQUINOX_LOGGER_NAME, enabled, environmentInfo);
      perfWriter = new EquinoxLogWriter((Writer) null, PERF_LOGGER_NAME, true, environmentInfo);
    }

    if ("true"
        .equals(environmentInfo.getConfiguration(EclipseStarter.PROP_CONSOLE_LOG))) // $NON-NLS-1$
    logWriter.setConsoleLog(true);
    logServiceManager = new LogServiceManager(logWriter, perfWriter);
    eclipseLogFactory = new EquinoxLogFactory(logWriter, logServiceManager);
    rootFrameworkLog = eclipseLogFactory.createFrameworkLog(null, logWriter);
  }
Example #2
0
 /* GuardedBy(lock) */
 private String generateName() {
   return "generated_" + Long.toString(nextID++); // $NON-NLS-1$;
 }