예제 #1
0
 public static String fetchPlatformLog() {
   final List<String> result = new ArrayList<String>();
   final File log = Platform.getLogFileLocation().toFile();
   try {
     final BufferedReader reader =
         new BufferedReader(new InputStreamReader(new FileInputStream(log), "UTF-8"));
     try {
       for (; ; ) {
         String line = reader.readLine();
         if (line == null) {
           break;
         }
         line = line.trim();
         if (line.length() == 0) {
           continue;
         }
         if (line.startsWith("!SESSION ")) {
           result.clear();
         }
         result.add(line);
       }
     } finally {
       reader.close();
     }
   } catch (final Exception e) {
     ErlLogger.warn(e);
   }
   final StringBuffer buf = new StringBuffer();
   for (final String s : result) {
     buf.append(s).append('\n');
   }
   return buf.toString();
 }
예제 #2
0
  /*
   * (non-Javadoc)
   * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
   */
  public void start(BundleContext context) throws Exception {
    // Print a session logging header.
    getLog().log(new Status(IStatus.OK, "Starting RAMSES plugin suite ...", "RAMSES starting ..."));
    ;

    // Set the level to FATAL for the plugin activation. Later, RAMSES will
    // will set the level to the user configuration.
    String lvl = "FATAL";
    RamsesConfiguration.setupLogging(lvl, Platform.getLogFileLocation().toFile(), false);
    try {
      super.start(context);
      plugin = this;

      /**
       * **** Always set Ramses resouce dirs before initialize Service Registry, instantiator and
       * AADL models manager !!! ***************************
       */
      WorkbenchUtils.setResourceDirectories();

      //	    MessageReporter4Osate msgReporter = new MessageReporter4Osate() ;
      //	    ServiceProvider.SYS_ERR_REP = new SysErrReporter4Osate(msgReporter) ;

      ServiceRegistry sr = new OSGiServiceRegistry();
      AadlModelInstantiatior instantiator;
      instantiator = new AadlModelsManagerImpl(ServiceRegistry.ANALYSIS_ERR_REPORTER_MANAGER);

      PredefinedAadlModelManager modelManager;
      //	    modelManager = new ContributedAadlRegistration() ;

      //	    sr.init(instantiator, modelManager);
      ServiceProvider.setDefault(sr);

      /** *********************************************************************** */
    } catch (Exception e) // Top level exception handler. Stop all process.
    {
      Logger.getLogger(Activator.class).fatal("", e);
      ServiceProvider.SYS_ERR_REP.fatal("", e);
    }
  }
예제 #3
0
 /**
  * Return the Eclipse .log file.
  *
  * @return the Eclipse .log file
  */
 public static File getLogFile() {
   return Platform.getLogFileLocation().toFile();
 }
예제 #4
0
 @After
 public void cleanup() {
   Platform.getLogFileLocation().toFile().delete();
 }