Java Code Examples for org.apache.log4j.Logger

The following are top voted examples for showing how to use org.apache.log4j.Logger. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: voicemenu   File: Command_TransformationMenu.java   Source Code and License 6 votes vote down vote up
@Nullable
protected TransformationMenuItem createItem(TransformationMenuContext context) {
  Command_TransformationMenu.TMP_SubMenu_8e2zmm_a0.TMP_Action_8e2zmm_b0a.Item item = new Command_TransformationMenu.TMP_SubMenu_8e2zmm_a0.TMP_Action_8e2zmm_b0a.Item(context);
  String description;
  try {
    description = "single item: " + item.getLabelText("");
  } catch (Throwable t) {
    Logger.getLogger(getClass()).error("Exception while executing getText of the item " + item, t);
    return null;
  }
  context.getEditorMenuTrace().pushTraceInfo();
  try {
    context.getEditorMenuTrace().setDescriptor(new EditorMenuDescriptorBase(description, new SNodePointer("r:7c1e5bbb-2d18-4cf3-a11d-502be6b13261(jetbrains.mps.samples.VoiceMenu.editor)", "7229855446159341697")));
    item.setTraceInfo(context.getEditorMenuTrace().getTraceInfo());
  } finally {
    context.getEditorMenuTrace().popTraceInfo();
  }
  return item;
}
 
Example 2
Project: SPLGroundControl   File: SPLGroungControlTest.java   Source Code and License 6 votes vote down vote up
@BeforeClass
public static void setUpClass() throws Exception {
    //Configure log4j
    ConsoleAppender console = new ConsoleAppender(); 
    String PATTERN = "%d [%p|%c|%C{1}] %m%n";
    console.setLayout(new PatternLayout(PATTERN)); 
    console.setThreshold(Level.DEBUG);
    console.activateOptions();

    Logger.getRootLogger().addAppender(console);

    System.out.println("SETUP: Starting SPLGroundControl...");
    config.init(args);

    daemon.init(new SPLGroundControl.SPLDaemonContext(args));
    daemon.start();
}
 
Example 3
Project: ripme   File: AbstractRipper.java   Source Code and License 6 votes vote down vote up
/**
 * Notifies observers and updates state if all files have been ripped.
 */
void checkIfComplete() {
    if (observer == null) {
        logger.debug("observer is null");
        return;
    }

    if (!completed) {
        completed = true;
        logger.info("   Rip completed!");

        RipStatusComplete rsc = new RipStatusComplete(workingDir, getCount());
        RipStatusMessage msg = new RipStatusMessage(STATUS.RIP_COMPLETE, rsc);
        observer.update(this, msg);

        Logger rootLogger = Logger.getRootLogger();
        FileAppender fa = (FileAppender) rootLogger.getAppender("FILE");
        if (fa != null) {
            logger.debug("Changing log file back to 'ripme.log'");
            fa.setFile("ripme.log");
            fa.activateOptions();
        }
        if (Utils.getConfigBoolean("urls_only.save", false)) {
            String urlFile = this.workingDir + File.separator + "urls.txt";
            try {
                Desktop.getDesktop().open(new File(urlFile));
            } catch (IOException e) {
                logger.warn("Error while opening " + urlFile, e);
            }
        }
    }
}
 
Example 4
Project: Drones-Simulator   File: RuleProcessors.java   Source Code and License 6 votes vote down vote up
@Override
public void run() {
    Logger.getLogger(RuleProcessors.class).info("Started RuleProcessors");
    while(!this.isInterrupted()) {
        GameEngineEvent msg;
        try {
            msg = incomingEvents.take();
        } catch (InterruptedException e) {
            Logger.getLogger(RuleProcessors.class).error("Interrupted while waiting for incoming event");
            this.interrupt();
            break;
        }

        if(msg != null) {
            this.processEventsForRules(Collections.singletonList(msg));
        } else {
            Logger.getLogger(RuleProcessors.class).error("Received event on incoming queue but was null!");
        }
    }

    Logger.getLogger(RuleProcessors.class).info("Ruleprocessors is shut down!");
}
 
Example 5
Project: voicemenu   File: Command_TransformationMenu.java   Source Code and License 6 votes vote down vote up
@Nullable
protected TransformationMenuItem createItem(TransformationMenuContext context) {
  Command_TransformationMenu.TMP_SubMenu_8e2zmm_a2.TMP_Action_8e2zmm_g0c.Item item = new Command_TransformationMenu.TMP_SubMenu_8e2zmm_a2.TMP_Action_8e2zmm_g0c.Item(context);
  String description;
  try {
    description = "single item: " + item.getLabelText("");
  } catch (Throwable t) {
    Logger.getLogger(getClass()).error("Exception while executing getText of the item " + item, t);
    return null;
  }
  context.getEditorMenuTrace().pushTraceInfo();
  try {
    context.getEditorMenuTrace().setDescriptor(new EditorMenuDescriptorBase(description, new SNodePointer("r:7c1e5bbb-2d18-4cf3-a11d-502be6b13261(jetbrains.mps.samples.VoiceMenu.editor)", "4660170996528419196")));
    item.setTraceInfo(context.getEditorMenuTrace().getTraceInfo());
  } finally {
    context.getEditorMenuTrace().popTraceInfo();
  }
  return item;
}
 
Example 6
Project: Rubus   File: GraphOutput.java   Source Code and License 6 votes vote down vote up
/**
   * Convenience method for outputting graph for a method to a given file.
   *
   * @param method  Method to output.
   * @param file    File for output.
   */
  public static void outputMethod(Method method, File file) {
    if(method.getImplementation() != null) {
      try {
        PrintStream outPS = new PrintStream(file);
        GraphOutput cfo = new GraphOutput(outPS);


        DebugUtil.printProperties(outPS);
//        DebugUtil.printNodeDiscription(outPS);

        method.getImplementation().accept(cfo);
        cfo.end();

        Logger.getLogger("diagrams").info("Diagram for " + method + " outputed to " + file + ".");
      } catch(IOException io) {
        Logger.getLogger("diagrams").warn("Could not output diagram to " + file + ".");
      }
    }
  }
 
Example 7
Project: hadoop   File: TaskLog.java   Source Code and License 6 votes vote down vote up
@SuppressWarnings("unchecked")
public static synchronized void syncLogs() {
  // flush standard streams
  //
  System.out.flush();
  System.err.flush();

  // flush flushable appenders
  //
  final Logger rootLogger = Logger.getRootLogger();
  flushAppenders(rootLogger);
  final Enumeration<Logger> allLoggers = rootLogger.getLoggerRepository().
    getCurrentLoggers();
  while (allLoggers.hasMoreElements()) {
    final Logger l = allLoggers.nextElement();
    flushAppenders(l);
  }
}
 
Example 8
Project: voicemenu   File: Activity_TransformationMenu.java   Source Code and License 6 votes vote down vote up
@Nullable
protected TransformationMenuItem createItem(TransformationMenuContext context) {
  Activity_TransformationMenu.TMP_SubMenu_rgk9zw_a2.TMP_Action_rgk9zw_a0c.Item item = new Activity_TransformationMenu.TMP_SubMenu_rgk9zw_a2.TMP_Action_rgk9zw_a0c.Item(context);
  String description;
  try {
    description = "single item: " + item.getLabelText("");
  } catch (Throwable t) {
    Logger.getLogger(getClass()).error("Exception while executing getText of the item " + item, t);
    return null;
  }
  context.getEditorMenuTrace().pushTraceInfo();
  try {
    context.getEditorMenuTrace().setDescriptor(new EditorMenuDescriptorBase(description, new SNodePointer("r:7c1e5bbb-2d18-4cf3-a11d-502be6b13261(jetbrains.mps.samples.VoiceMenu.editor)", "8720745441970485769")));
    item.setTraceInfo(context.getEditorMenuTrace().getTraceInfo());
  } finally {
    context.getEditorMenuTrace().popTraceInfo();
  }
  return item;
}
 
Example 9
Project: worm   File: HbaseConnectionWarehouse.java   Source Code and License 6 votes vote down vote up
private HbaseConnectionWarehouse() {
	conns = new LinkedList<>();
	logger = Logger.getLogger(HbaseConnectionWarehouse.class);  // logger
	conf = HBaseConfiguration.create();							// configuration
	
	Properties properties = new Properties();
	try {
		properties.load(new FileInputStream("/home/xwtech/configuration/configuration.properties"));
	} catch (Exception e) {
		logger.error("读取properties文件出错!\n"+e.getMessage());
	} 
	maxSize = Integer.parseInt(properties.getProperty("hbaseConnectionMaxsize", "5"));
	String quorum = properties.getProperty("hbaseZookeeperQuorum", "n1.cluster,n2.cluster,n3.cluster");
	
	conf.set("hbase.zookeeper.quorum", quorum);
	
	currentSize = 0;
	usableSize = 0;
}
 
Example 10
Project: ats-framework   File: StartCheckpointEvent.java   Source Code and License 6 votes vote down vote up
public StartCheckpointEvent( String fqnOfCategoryClass,
                             Logger logger,
                             String name,
                             String transferUnit,
                             String threadName,
                             long startTimestamp ) {

    super(fqnOfCategoryClass,
          logger,
          "Start checkpoint '" + name + "'",
          LoggingEventType.START_CHECKPOINT);

    this.startTimestamp = startTimestamp;
    this.name = name;
    this.transferUnit = transferUnit;
    this.threadName = threadName;
}
 
Example 11
Project: DIA-Umpire-Maven   File: UmpireSpecLibMatch.java   Source Code and License 6 votes vote down vote up
@Override
public void run() {
    if (fragmentLib != null) {
        if (IdentifiedPeptideIon) {
            IDPeak();
        } else {
            Target();
            if (decoyfragmentLib != null) {
                Decoy();
            } else {
                Logger.getRootLogger().error("decoy spectrum is null : " + pepIonID.GetKey());
            }
        }
    } else {
        Logger.getRootLogger().warn("lib spectrum is null : " + pepIonID.GetKey());
    }
}
 
Example 12
Project: ibench   File: iBenchDriver.java   Source Code and License 6 votes vote down vote up
private static void setUpConfigLogger(File pathF, String configName) throws IOException {
	Logger.getRootLogger().removeAllAppenders();
	
	String nameSuffix = configName.replace(".txt", "");
	
	PropertyConfigurator.configure("resource/log4jproperties.txt");	
	
	FileAppender logFileAppender = new FileAppender(
			new PatternLayout("%-4r [%t] %-5p %c %x - %m%n"),
			new File(pathF, "log_" + nameSuffix + ".txt").toString(), false);
	Logger.getRootLogger().addAppender(logFileAppender);
	
	if (opt.logToConsole)
		Logger.getRootLogger().addAppender(new ConsoleAppender(
				new PatternLayout("%-4r [%t] %-5p %c %x - %m%n")));
}
 
Example 13
Project: DIA-Umpire-Maven   File: LCMSPeakDIAMS2.java   Source Code and License 6 votes vote down vote up
private boolean FSCluster2CurveUnfragRead() {
    if (!new File(FilenameUtils.getFullPath(ParentmzXMLName) + FilenameUtils.getBaseName(ParentmzXMLName) + "_Peak/" + FilenameUtils.getBaseName(ScanCollectionName) + "_UnfClus2Cur.serFS").exists()) {
        return false;
    }
    try {
        Logger.getRootLogger().debug("Reading UnfragPrecursorFragCorr serialization from file:" + FilenameUtils.getBaseName(ScanCollectionName) + "_UnfClus2Cur.serFS...");
        FileInputStream fileIn = new FileInputStream(FilenameUtils.getFullPath(ParentmzXMLName) + FilenameUtils.getBaseName(ParentmzXMLName) + "_Peak/" + FilenameUtils.getBaseName(ScanCollectionName) + "_UnfClus2Cur.serFS");
        FSTObjectInput in = new FSTObjectInput(fileIn);
        UnFragIonClu2Cur = (HashMap<Integer, ArrayList<PrecursorFragmentPairEdge>>) in.readObject();
        in.close();
        fileIn.close();

    } catch (Exception ex) {
        Logger.getRootLogger().error(ExceptionUtils.getStackTrace(ex));
        return false;
    }
    return true;
}
 
Example 14
Project: ats-framework   File: UpdateTestcaseEvent.java   Source Code and License 6 votes vote down vote up
public UpdateTestcaseEvent( String loggerFQCN, Logger logger, int testcaseId, String suiteFullName,
                            String suiteSimpleName, String scenarioName, String inputArguments,
                            String scenarioDescription, String userNote, int testcaseResult,
                            long timestamp ) {

    super(loggerFQCN, logger,
          "Update testcase with id '" + testcaseId + "'",
          suiteFullName, suiteSimpleName, scenarioName, inputArguments, scenarioDescription,
          LoggingEventType.UPDATE_TEST_CASE);

    this.testcaseId = testcaseId;
    this.testcaseResult = testcaseResult;
    this.userNote = userNote;

    if (StringUtils.isNullOrEmpty(scenarioName) || StringUtils.isNullOrEmpty(inputArguments)) {

        this.testcaseName = null;
    }

}
 
Example 15
Project: voicemenu   File: Timeout_TransformationMenu.java   Source Code and License 6 votes vote down vote up
@Nullable
protected TransformationMenuItem createItem(TransformationMenuContext context) {
  Timeout_TransformationMenu.TMP_SubMenu_4a1v5f_b0.TMP_Action_4a1v5f_b1a.Item item = new Timeout_TransformationMenu.TMP_SubMenu_4a1v5f_b0.TMP_Action_4a1v5f_b1a.Item(context);
  String description;
  try {
    description = "single item: " + item.getLabelText("");
  } catch (Throwable t) {
    Logger.getLogger(getClass()).error("Exception while executing getText of the item " + item, t);
    return null;
  }
  context.getEditorMenuTrace().pushTraceInfo();
  try {
    context.getEditorMenuTrace().setDescriptor(new EditorMenuDescriptorBase(description, new SNodePointer("r:7c1e5bbb-2d18-4cf3-a11d-502be6b13261(jetbrains.mps.samples.VoiceMenu.editor)", "8455589616271350507")));
    item.setTraceInfo(context.getEditorMenuTrace().getTraceInfo());
  } finally {
    context.getEditorMenuTrace().popTraceInfo();
  }
  return item;
}
 
Example 16
Project: voicemenu   File: Event_TransformationMenu.java   Source Code and License 6 votes vote down vote up
@Nullable
protected TransformationMenuItem createItem(TransformationMenuContext context) {
  Event_TransformationMenu.TMP_SubMenu_8shh52_a4.TMP_Action_8shh52_b0e.Item item = new Event_TransformationMenu.TMP_SubMenu_8shh52_a4.TMP_Action_8shh52_b0e.Item(context);
  String description;
  try {
    description = "single item: " + item.getLabelText("");
  } catch (Throwable t) {
    Logger.getLogger(getClass()).error("Exception while executing getText of the item " + item, t);
    return null;
  }
  context.getEditorMenuTrace().pushTraceInfo();
  try {
    context.getEditorMenuTrace().setDescriptor(new EditorMenuDescriptorBase(description, new SNodePointer("r:7c1e5bbb-2d18-4cf3-a11d-502be6b13261(jetbrains.mps.samples.VoiceMenu.editor)", "5283568769195041136")));
    item.setTraceInfo(context.getEditorMenuTrace().getTraceInfo());
  } finally {
    context.getEditorMenuTrace().popTraceInfo();
  }
  return item;
}
 
Example 17
Project: ibench   File: iBenchDriver.java   Source Code and License 6 votes vote down vote up
private static void setUpExperimentalLogger(File pathF) throws IOException {
	
	Logger.getRootLogger().removeAllAppenders();
	log.removeAllAppenders();
	
	PropertyConfigurator.configure("resource/log4jproperties.txt");
	
	FileAppender resultAppender = new FileAppender(
			new PatternLayout("%m"),
			new File(pathF, "result.txt").toString(), false);
	
	LevelRangeFilter infoFilter = new LevelRangeFilter();
	infoFilter.setLevelMin(Level.INFO);
	infoFilter.setLevelMax(Level.FATAL);
	infoFilter.setAcceptOnMatch(true);
	resultAppender.addFilter(infoFilter);
	log.addAppender(resultAppender);
	Logger.getLogger(iBench.class).addAppender(resultAppender);
	
}
 
Example 18
Project: voicemenu   File: Activity_TransformationMenu.java   Source Code and License 6 votes vote down vote up
@Nullable
protected TransformationMenuItem createItem(TransformationMenuContext context) {
  Activity_TransformationMenu.TMP_SubMenu_rgk9zw_a0.TMP_Action_rgk9zw_b0a.Item item = new Activity_TransformationMenu.TMP_SubMenu_rgk9zw_a0.TMP_Action_rgk9zw_b0a.Item(context);
  String description;
  try {
    description = "single item: " + item.getLabelText("");
  } catch (Throwable t) {
    Logger.getLogger(getClass()).error("Exception while executing getText of the item " + item, t);
    return null;
  }
  context.getEditorMenuTrace().pushTraceInfo();
  try {
    context.getEditorMenuTrace().setDescriptor(new EditorMenuDescriptorBase(description, new SNodePointer("r:7c1e5bbb-2d18-4cf3-a11d-502be6b13261(jetbrains.mps.samples.VoiceMenu.editor)", "8720745441960649988")));
    item.setTraceInfo(context.getEditorMenuTrace().getTraceInfo());
  } finally {
    context.getEditorMenuTrace().popTraceInfo();
  }
  return item;
}
 
Example 19
Project: Babler   File: LanguageClassifier.java   Source Code and License 5 votes vote down vote up
/**
 * Generates a list of support languages by this classifier
 * @param langs a list of language names (not codes). For example English, Hebrew, Spanish
 */
protected void buildListOfSupportedLanguageCodesFromLanguageNames(String [] langs){
    this.supportedLanguages = new ArrayList<>();
     Logger log = Logger.getLogger(LanguageClassifier.class);
    for(String lang : langs){
        try {
            supportedLanguages.add(LanguageCode.convertLanguageNameToCode(lang));
        } catch (Exception e) {
            log.error(e);
        }
    }
}
 
Example 20
Project: Rubus   File: AnnotationImporter.java   Source Code and License 5 votes vote down vote up
/**
 * Sets the value for enum methods/values.
 *
 * @param key    Method to set.
 * @param type   Name of the enum class type.
 * @param value  Value for method.
 */
@Override
public void visitEnum(String key, String type, String value) {
  try {
    annotation.set(key, Enum.valueOf(
      (Class<? extends Enum>) Class.forName(Type.getType(type).getClassName()),
      value
    ));
  } catch (ClassNotFoundException ex) {
    Logger.getLogger("annotation").log(Level.FATAL, null, ex);
  }
}
 
Example 21
Project: hadoop   File: TestYarnClient.java   Source Code and License 5 votes vote down vote up
@Test(timeout = 30000)
public void testApplicationType() throws Exception {
  Logger rootLogger = LogManager.getRootLogger();
  rootLogger.setLevel(Level.DEBUG);
  MockRM rm = new MockRM();
  rm.start();
  RMApp app = rm.submitApp(2000);
  RMApp app1 =
      rm.submitApp(200, "name", "user",
        new HashMap<ApplicationAccessType, String>(), false, "default", -1,
        null, "MAPREDUCE");
  Assert.assertEquals("YARN", app.getApplicationType());
  Assert.assertEquals("MAPREDUCE", app1.getApplicationType());
  rm.stop();
}
 
Example 22
Project: incubator-servicecomb-java-chassis   File: Log4JMetricsFileWriter.java   Source Code and License 5 votes vote down vote up
@Override
public void write(String loggerName, String filePrefix, String content) {
  RollingFileAppender logger = fileAppenders.computeIfAbsent(loggerName, f -> initLogger(loggerName, filePrefix));
  LoggingEvent event = new LoggingEvent(loggerName, Logger.getLogger(loggerName), Level.ALL,
      content, null);
  logger.append(event);
}
 
Example 23
Project: ditb   File: LogMonitoring.java   Source Code and License 5 votes vote down vote up
public static Set<File> getActiveLogFiles() throws IOException {
  Set<File> ret = Sets.newHashSet();
  Appender a;
  @SuppressWarnings("unchecked")
  Enumeration<Appender> e = Logger.getRootLogger().getAllAppenders();
  while (e.hasMoreElements()) {
    a = e.nextElement();
    if (a instanceof FileAppender) {
      FileAppender fa = (FileAppender) a;
      String filename = fa.getFile();
      ret.add(new File(filename));
    }
  }
  return ret;
}
 
Example 24
Project: siddhi-map-json   File: JsonSourceMapperTestCase.java   Source Code and License 5 votes vote down vote up
@Test
public void jsonSourceMapper20() throws InterruptedException {
    log.info("test JsonSourceMapper with test Test values type boolean");
    log = Logger.getLogger(JsonSourceMapper.class);
    UnitTestAppender appender = new UnitTestAppender();
    log.addAppender(appender);
    String streams = "" +
            "@App:name('TestSiddhiApp')" +
            "@source(type='inMemory', topic='stock', @map(type='json')) " +
            "define stream FooStream (symbol Bool, price double, volume int); " +
            "define stream BarStream (symbol Bool, price double, volume int); ";
    String query = "" +
            "from FooStream " +
            "select * " +
            "insert into BarStream; ";
    SiddhiManager siddhiManager = new SiddhiManager();
    SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(streams + query);

    siddhiAppRuntime.start();
    InMemoryBroker.publish("stock", " {\n" +
            "      \"event\":{\n" +
            "         \"symbol\":\"true\",\n" +
            "         \"price\":55,\n" +
            "         \"volume\":100.0\n" +
            "      }\n" +
            " }");
    AssertJUnit.assertTrue(appender.getMessages().contains("contains incompatible attribute types and values"));
    siddhiAppRuntime.shutdown();
}
 
Example 25
Project: DIA-Umpire-Maven   File: DIA_Setting.java   Source Code and License 5 votes vote down vote up
public void WriteDIASettingSerialization(String mzXMLFileName) {
    try {
        Logger.getRootLogger().info("Writing DIA setting to file:" + FilenameUtils.getFullPath(mzXMLFileName) + FilenameUtils.getBaseName(mzXMLFileName) + "_diasetting.ser...");
        FileOutputStream fout = new FileOutputStream(FilenameUtils.getFullPath(mzXMLFileName) + FilenameUtils.getBaseName(mzXMLFileName) + "_diasetting.ser", false);
        ObjectOutputStream oos = new ObjectOutputStream(fout);
        oos.writeObject(this);
        oos.close();
        fout.close();
    } catch (Exception ex) {
        Logger.getRootLogger().error(ExceptionUtils.getStackTrace(ex));
    }
}
 
Example 26
Project: ibench   File: iBench.java   Source Code and License 5 votes vote down vote up
/**
 *  read log4j properties from user defined location or default location
 * @throws FileNotFoundException 
 */
public void reconfigLog() throws FileNotFoundException {
	File location = _configuration.getLogConfig();
	Level llevel = _configuration.loglevel;
	Logger.getRootLogger().removeAllAppenders();
	progressAndResultLog.setAdditivity(false);
	
	// user provided log location?
	if (location != null) {
		if (!location.exists())
		{
			System.err.printf("User provided log location does not exist: %s", location);
			System.exit(1);
		}
		PropertyConfigurator.configure(new FileInputStream(location));
		log.info("user has provided log level location: " +  location);
	}
	// user has given a global log level
	else if (llevel != null) {
		ConsoleAppender c = new ConsoleAppender();
		c.setLayout(new PatternLayout("%-4r [%t] %-5p %l - %m%n"));
		c.setThreshold(llevel);
		c.activateOptions();
		Logger.getRootLogger().addAppender(c);			
	
		log.info("user set log level to " + llevel.toString());
	}
	// do we have a log file at the default location
	else if (new File(LOG4JPROPERIES_DEFAULT_LOCATION).exists())
	{
		defaultLogPropertyFileConfig();
		log.info("use default log properties location " + LOG4JPROPERIES_DEFAULT_LOCATION);
	}
	// just set everything to error log level
	else {
		defaultLogConfig();
	}
	
	outputLog(llevel == null ? Level.INFO : llevel);	
}
 
Example 27
Project: gmusic-java   File: Utils.java   Source Code and License 5 votes vote down vote up
/**
 * Singleton pattern for logger
 * Adds a <code>ConsoleAppender</code> on initialization
 * @return <code>Logger</code>
 */
public static Logger getLogger() {
    if(logger == null) {
        logger = Logger.getRootLogger();
        ConsoleAppender appender = new ConsoleAppender();

        appender.setLayout(new PatternLayout("[%-5p] %d{HH:mm:ss.SSS} [%t] - %m %n"));
        appender.setThreshold(Level.ALL);
        appender.activateOptions();
        logger.addAppender(appender);
    }
    return logger;
}
 
Example 28
Project: s-store   File: RingBufferAppender.java   Source Code and License 5 votes vote down vote up
@SuppressWarnings("unchecked")
public static Collection<String> getLoggingMessages(LoggerRepository repo) {
    Set<RingBufferAppender> appenders = new HashSet<RingBufferAppender>();
    for (Object o : CollectionUtil.iterable(repo.getCurrentLoggers())) {
        Logger logger = (Logger)o;
        RingBufferAppender rba = getRingBufferAppender(logger);
        if (rba != null) {
             if (LOG.isDebugEnabled())
                LOG.debug(logger.getName() + " => " + rba + " / " + rba.getLayout());
            appenders.add(rba);
        }
    } // FOR
    if (appenders.isEmpty()) return (Collections.emptyList());
    return (getLoggingMessages(appenders.toArray(new RingBufferAppender[0]))); 
}
 
Example 29
Project: ats-framework   File: RememberLoadQueueStateEvent.java   Source Code and License 5 votes vote down vote up
public RememberLoadQueueStateEvent( String loggerFQCN, Logger logger, String name, int loadQueueId,
                                    String threadingPattern, int numberThreads ) {

    super(loggerFQCN, logger, "Remember load queue '" + name + "' state",
          LoggingEventType.REMEMBER_LOADQUEUE_STATE);

    this.name = name;
    this.loadQueueId = loadQueueId;
    this.threadingPattern = threadingPattern;
    this.numberThreads = numberThreads;
}
 
Example 30
Project: convertigo-engine   File: LogStep.java   Source Code and License 5 votes vote down vote up
@Override
protected boolean stepExecute(Context javascriptContext, Scriptable scope) throws EngineException {
	if (isEnabled()) {
		if (super.stepExecute(javascriptContext, scope)) {
			Logger log = null;
			if(logger.equals(Engine.logEngine.getName())) 
				log = Engine.logEngine;
			else if(logger.equals(Engine.logContext.getName()))
				log = Engine.logContext;
			else if(logger.equals(Engine.logUser.getName()))
				log = Engine.logUser;
			else if(logger.equals(Engine.logAudit.getName())) 
				log = Engine.logAudit;
			if(level.equals(Level.WARN.toString()) && log.isEnabledFor(Level.WARN))
				log.warn(getEvalString(javascriptContext, scope));
			else if(level.equals(Level.INFO.toString()) && log.isInfoEnabled())
				log.info(getEvalString(javascriptContext, scope));
			else if(level.equals(Level.DEBUG.toString()) && log.isDebugEnabled())
				log.debug(getEvalString(javascriptContext, scope));
			else if(level.equals(Level.TRACE.toString()) && log.isTraceEnabled())
				log.trace(getEvalString(javascriptContext, scope));
			else if(level.equals(Level.ERROR.toString()) && log.isEnabledFor(Level.ERROR))
				log.error(getEvalString(javascriptContext, scope));
			return true;
		}
	}
	return false;
}
 
Example 31
Project: belling-admin   File: LoggerUtils.java   Source Code and License 5 votes vote down vote up
/**
 * Error 输出
 * @param clazz  	目标.Class
 * @param message	输出信息
 * @param e			异常类
 */
public static void error(Class<? extends Object> clazz ,String message,Exception e){
	Logger logger = Logger.getLogger(clazz);
	if(null == e){
		logger.error(message);
		return ;
	}
	logger.error(message, e);
}
 
Example 32
Project: LightSIP   File: LogWriter.java   Source Code and License 5 votes vote down vote up
/**
 * Log an error message.
 *
 * @param message --
 *            error message to log.
 */
public void logFatalError(String message) {
    Logger logger = this.getLogger();
    String newMsg = this.enhanceMessage(message);
    countLines(newMsg);
    logger.fatal(newMsg);

}
 
Example 33
Project: zipkin-sparkstreaming   File: LogInitializer.java   Source Code and License 5 votes vote down vote up
@Override public void run() {
  Logger zipkinLogger = LogManager.getLogger("zipkin");
  if (!log4Jlevel().equals(zipkinLogger.getLevel())) {
    zipkinLogger.setLevel(log4Jlevel());
    if (zipkinLogger.getAdditivity()) {
      addLogAppendersFromRoot(zipkinLogger);
    }
  }
  java.util.logging.Logger.getLogger("zipkin").setLevel(julLevel());
}
 
Example 34
Project: flume-release-1.7.0   File: TestLog4jAppender.java   Source Code and License 5 votes vote down vote up
@Test
public void testLog4jAppenderFailureUnsafeMode() throws Throwable {
  configureSource();
  props.setProperty("log4j.appender.out2.UnsafeMode", String.valueOf(true));
  PropertyConfigurator.configure(props);
  Logger logger = LogManager.getLogger(TestLog4jAppender.class);
  source.stop();
  sendAndAssertFail(logger);

}
 
Example 35
Project: WeiXing_xmu-2016-MrCode   File: BaseServiceImpl.java   Source Code and License 5 votes vote down vote up
@SuppressWarnings("unchecked")
public BaseServiceImpl() {
	ParameterizedType type = (ParameterizedType) this.getClass()
			.getGenericSuperclass();
	clazz = (Class<T>) type.getActualTypeArguments()[0];
	log = Logger.getLogger(clazz);
}
 
Example 36
Project: ats-framework   File: ActionClassOne.java   Source Code and License 5 votes vote down vote up
@Action( name = "action array")
public int action1(
                    @Parameter( name = "valueToMatch", validation = ValidationType.NUMBER_CONSTANT, args = { "VALID_CONSTANTS" }) int[] values ) {

    ACTION_VALUE = values[values.length - 1];
    Logger.getLogger(ActionClassOne.class).info("Method action array has been executed");

    return ACTION_VALUE;
}
 
Example 37
Project: sstore-soft   File: LoggerUtil.java   Source Code and License 5 votes vote down vote up
public void run() {
    if (PROPERTIES_FILE == null) setupLogging();
    Thread self = Thread.currentThread();
    self.setName(HStoreConstants.THREAD_NAME_LOGGING);
    
    while (!self.isInterrupted()) {
        try {
            Thread.sleep(this.interval);
        } catch (InterruptedException ex) {
            break;
        }
        
        // HACK: Look for an HStoreSite so that we can set our name properly
        // This probably doesn't need to be synchronized
        if (THREAD_MANAGER == null) {
            synchronized (LoggerUtil.class) {
                if (THREAD_MANAGER == null) {
                    HStoreSite hstore_site = HStore.instance();
                    if (hstore_site != null) {
                        String name = HStoreThreadManager.getThreadName(hstore_site, HStoreConstants.THREAD_NAME_LOGGING);
                        self.setName(name);
                        THREAD_MANAGER = hstore_site.getThreadManager();
                        THREAD_MANAGER.registerProcessingThread();
                    }
                }
            } // SYNCH
        }
        
        // Refresh our configuration if the file has changed
        if (PROPERTIES_FILE != null && LAST_TIMESTAMP != PROPERTIES_FILE.lastModified()) {
            loadConfiguration(PROPERTIES_FILE);
            assert(PROPERTIES_FILE != null);
            Logger.getRootLogger().info("Refreshed log4j configuration [" + PROPERTIES_FILE.getAbsolutePath() + "]");
            LoggerUtil.OBSERVABLE.notifyObservers();
        }
    }
}
 
Example 38
Project: LightSIP   File: WebsocketSelfTest.java   Source Code and License 5 votes vote down vote up
public void setUp() {
  	System.setProperty( "javax.net.ssl.keyStore",  TlsTest.class.getResource("testkeys").getPath() );
System.setProperty( "javax.net.ssl.trustStore", TlsTest.class.getResource("testkeys").getPath() );
System.setProperty( "javax.net.ssl.keyStorePassword", "passphrase" );
System.setProperty( "javax.net.ssl.keyStoreType", "jks" );
  	ConsoleAppender console = new ConsoleAppender();
  	console.setName("Console app");
  	String PATTERN = "%d [%p|%c|%C{1}] %m%n";
  	console.setLayout(new PatternLayout(PATTERN)); 
  	console.setThreshold(Level.DEBUG);
  	console.activateOptions();
  	Logger.getRootLogger().addAppender(console);
  	this.websocketServer = new WebsocketServer();
  	this.websocketBrowser = new WebsocketBrowser();
  }
 
Example 39
Project: unitimes   File: Loggers.java   Source Code and License 5 votes vote down vote up
@Override
@PreAuthorize("checkPermission('ApplicationConfig')")
public SimpleEditInterface load(SessionContext context, Session hibSession) {
	List<ListItem> levels = new ArrayList<ListItem>();
	levels.add(new ListItem(String.valueOf(Level.ALL_INT), MESSAGES.levelAll()));
	levels.add(new ListItem(String.valueOf(Level.TRACE_INT), MESSAGES.levelTrace()));
	levels.add(new ListItem(String.valueOf(Level.DEBUG_INT), MESSAGES.levelDebug()));
	levels.add(new ListItem(String.valueOf(Level.INFO_INT), MESSAGES.levelInfo()));
	levels.add(new ListItem(String.valueOf(Level.WARN_INT), MESSAGES.levelWarning()));
	levels.add(new ListItem(String.valueOf(Level.ERROR_INT), MESSAGES.levelError()));
	levels.add(new ListItem(String.valueOf(Level.FATAL_INT), MESSAGES.levelFatal()));
	levels.add(new ListItem(String.valueOf(Level.OFF_INT), MESSAGES.levelOff()));
	
	SimpleEditInterface data = new SimpleEditInterface(
			new Field(MESSAGES.fieldLogger(), FieldType.text, 400, 1024, Flag.UNIQUE),
			new Field(MESSAGES.fieldLevel(), FieldType.list, 100, levels, Flag.NOT_EMPTY));
	data.setSortBy(0, 1);
	
	long id = 0;
	SimpleEditInterface.Record root = data.addRecord(id++, false);
	root.setField(0, " root", false);
	root.setField(1, String.valueOf(LogManager.getRootLogger().getLevel().toInt()));
	
	for (Enumeration e = LogManager.getCurrentLoggers(); e.hasMoreElements(); ) {
		Logger logger = (Logger)e.nextElement();
		if (logger.getLevel() == null) continue;
		ApplicationConfig config = ApplicationConfig.getConfig("log4j.logger." + logger.getName());
		SimpleEditInterface.Record record = data.addRecord(id++, ApplicationProperties.getDefaultProperties().getProperty("log4j.logger." + logger.getName()) == null && config != null);
		record.setField(0, logger.getName(), false);
		record.setField(1, String.valueOf(logger.getLevel().toInt()));
	}

	data.setEditable(context.hasPermission(Right.ApplicationConfig));
	return data;
}
 
Example 40
Project: metacherchant   File: IOUtils.java   Source Code and License 5 votes vote down vote up
public static BigLong2ShortHashMap loadReads(File[] files, int k, int minSeqLen,
                                             int availableProcessors, Logger logger)
        throws ExecutionFailedException {
    BigLong2ShortHashMap hm = new BigLong2ShortHashMap(
            (int) (Math.log(availableProcessors) / Math.log(2)) + 4, 12, true);

    ReadsLoadWorker[] workers = new ReadsLoadWorker[availableProcessors];
    for (int i = 0; i < workers.length; ++i) {
        workers[i] = new ReadsLoadWorker(hm, k, minSeqLen);
    }

    run(files, workers, hm, logger);

    // calculating statistics...
    int totalSeq = 0, goodSeq = 0;
    long totalLen = 0, goodLen = 0;
    for (ReadsLoadWorker worker : workers) {
        totalSeq += worker.totalSeq;
        goodSeq += worker.goodSeq;
        totalLen += worker.totalLen;
        goodLen += worker.goodLen;
    }
    Tool.debug(logger,
            "Good/Total sequences count = " + NumUtils.groupDigits(goodSeq) + "/" + NumUtils.groupDigits(totalSeq)
            + " (" + String.format("%.1f", goodSeq * 100.0 / totalSeq) + "%)");
    Tool.debug(logger,
            "Good/Total sequences length = " + NumUtils.groupDigits(goodLen) + "/" + NumUtils.groupDigits(totalLen)
                    + " (" + String.format("%.1f", goodLen * 100.0 / totalLen) + "%)");
    logger.debug("k-mers HM size = " + NumUtils.groupDigits(hm.size()));

    return hm;
}
 
Example 41
Project: CloudDB   File: RepConnection.java   Source Code and License 5 votes vote down vote up
public RepConnection(int port, StorageManager storageManager, Logger logger){
	try {
		replicaSocket = new ServerSocket(port+20);
	} catch (IOException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}

	this.storageManager = storageManager;
	this.logger = logger;
}
 
Example 42
Project: ats-framework   File: DeleteTestCaseEvent.java   Source Code and License 5 votes vote down vote up
public DeleteTestCaseEvent( String loggerFQCN,
                            Logger logger,
                            int testcaseId ) {

    super(loggerFQCN, logger, "Delete test case", LoggingEventType.DELETE_TEST_CASE);

    this.testcaseId = testcaseId;
}
 
Example 43
Project: Lagerta   File: Worker.java   Source Code and License 5 votes vote down vote up
/** */
public Worker(Ignite ignite, LoadTestConfig config, long startPosition, long endPosition,
    Generator keyGenerator, Generator valueGenerator) {
    this.ignite = ignite;
    this.config = config;
    this.startPosition = startPosition;
    this.endPosition = endPosition;
    this.keyGenerator = keyGenerator;
    this.valueGenerator = valueGenerator;
    log = Logger.getLogger(loggerName());
    warmup = config.getWarmupPeriod() != 0;
}
 
Example 44
Project: sstore-soft   File: CatalogUtil.java   Source Code and License 5 votes vote down vote up
public static String loadCatalogFromJar(String pathToCatalog, Logger log) {
    assert(pathToCatalog != null);

    String serializedCatalog = null;
    try {
        serializedCatalog = JarReader.readFileFromJarfile(pathToCatalog, CATALOG_FILENAME);
    } catch (Exception e) {
        if (log != null)
            log.l7dlog( Level.FATAL, LogKeys.host_VoltDB_CatalogReadFailure.name(), e);
        return null;
    }

    return serializedCatalog;
}
 
Example 45
Project: DIA-Umpire-Maven   File: FastaParser.java   Source Code and License 5 votes vote down vote up
public FastaParser(String filename) {
    ProteinList = new HashMap<>();
    try {
        Parse(filename);
    } catch (IOException ex) {
        Logger.getRootLogger().error(ExceptionUtils.getStackTrace(ex));
    }
}
 
Example 46
Project: hadoop-oss   File: TestLog4Json.java   Source Code and License 5 votes vote down vote up
private String logOut(String message, Throwable throwable) {
  StringWriter writer = new StringWriter();
  Logger logger = createLogger(writer);
  logger.info(message, throwable);
  //remove and close the appender
  logger.removeAllAppenders();
  return writer.toString();
}
 
Example 47
Project: Hydrograph   File: ExecutionTrackingLogger.java   Source Code and License 5 votes vote down vote up
/**
    * 
    * Get logger for logging execution status of the running job
    * 
    * @param jobID
    * @param fileLogLocation
    * @return {@link Logger}
    */
public Logger getLogger(String jobID,String fileLogLocation) {
	
	if (executionTrackingLoggers.containsKey(jobID)) {
		return executionTrackingLoggers.get(jobID);
	}
	
	//creates pattern layout
	PatternLayout layout = new PatternLayout();
	layout.setConversionPattern("%m%n");
	
	//create file appender
	FileAppender fileAppender = new FileAppender();
	fileAppender.setFile(fileLogLocation);
	fileAppender.setLayout(layout);
	fileAppender.activateOptions();
	//configures the root logger
	
	Logger logger = Logger.getLogger(jobID);
	logger.setLevel(Level.DEBUG);
	logger.addAppender(fileAppender);
	logger.getRootLogger().setAdditivity(false);
	logger.setAdditivity(false);
	executionTrackingLoggers.put(jobID, logger);
	
       return logger;
   }
 
Example 48
Project: Babler   File: TextCategorizer.java   Source Code and License 5 votes vote down vote up
/**
 * clears the categories-collection and fills it with the FingerPrints given
 * in the configuration file.
 */
private void loadCategories() {
	this.categories.clear();
	Logger log = Logger.getLogger(TextCategorizer.class);
	try {
		MyProperties properties = new MyProperties();
		if (confFile == null) {
			properties.load(TextCategorizer.class.getClassLoader()
					.getResourceAsStream(jarConfFile));
		} else {
			properties.load(new FileInputStream(confFile.toString()));
		}
		for (Entry<String, String> entry : properties.entrySet()) {
			FingerPrint fp;
			if (confFile == null) {
				fp = new FingerPrint(TextCategorizer.class.getClassLoader()
						.getResourceAsStream(entry.getKey()));
			} else {
				fp = new FingerPrint(BabelConfig.getResourcesPath() + entry.getKey());
			}
			fp.setCategory(entry.getValue());
			this.categories.add(fp);
               this.supportedLanguages.add(new LanguageCode(entry.getValue(), LanguageCode.CodeTypes.ISO_639_2));
		}
	} catch (FileNotFoundException fnfe) {
		log.error(fnfe);
	}
}
 
Example 49
Project: metacherchant   File: IOUtils.java   Source Code and License 5 votes vote down vote up
public static void calculatePresenceForKmers(File[] files, BigLong2LongHashMap hm, int availableProcessors, Logger logger)
        throws ExecutionFailedException {
    BytesWorker[] workers = new BytesWorker[availableProcessors];
    for (int i = 0; i < workers.length; ++i) {
        workers[i] = new KmersPresenceWorker(hm);
    }
    run(files, workers, null, logger);
}
 
Example 50
Project: ats-framework   File: JschSshClient.java   Source Code and License 5 votes vote down vote up
StreamReader( InputStream is,
              Channel channel,
              String type ) {

    log = Logger.getLogger(StreamReader.class.getSimpleName() + " <" + type + ">");

    this.is = is;
    this.type = type;
    this.channel = channel;
}
 
Example 51
Project: DIA-Umpire-Maven   File: InstrumentParameter.java   Source Code and License 5 votes vote down vote up
public void WriteParamSerialization(String mzXMLFileName) {
    try {
        Logger.getRootLogger().info("Writing parameter to file:" + FilenameUtils.getFullPath(mzXMLFileName) + FilenameUtils.getBaseName(mzXMLFileName) + "_params.ser...");
        FileOutputStream fout = new FileOutputStream(FilenameUtils.getFullPath(mzXMLFileName) + FilenameUtils.getBaseName(mzXMLFileName) + "_params.ser", false);
        ObjectOutputStream oos = new ObjectOutputStream(fout);
        oos.writeObject(this);
        oos.close();
        fout.close();
    } catch (Exception ex) {
        Logger.getRootLogger().error(ExceptionUtils.getStackTrace(ex));
    }
}
 
Example 52
Project: Proyecto-DASI   File: GestorAccionesAgteReactivoImp.java   Source Code and License 5 votes vote down vote up
@Override   
public void inicializarInfoAcciones(Class claseAccionAinicializar, Object... paramsInicializacion){
    String identClase = claseAccionAinicializar.getSimpleName();
    try {
    if ( identClase.equals(accionesSemAgteReactivoSimpleName)){
        envioInputs = (ItfProductorPercepcion)paramsInicializacion[0];
         itfControlAgte = (ItfControlAgteReactivo)paramsInicializacion[1];
    }
   } catch (Exception ex) {
       java.util.logging.Logger.getLogger(GestorAccionesAgteReactivoImp.class.getName()).log(Level.SEVERE, null, ex);
       this.trazas.trazar("GestorAccionesAgteReactivoImp", "Operacion de inicializar Accion. Error en los objetos de inicializacion: Revisar ", InfoTraza.NivelTraza.error);
}
  }
 
Example 53
Project: WeiXing_xmu-2016-MrCode   File: BaseAction.java   Source Code and License 5 votes vote down vote up
/*******************************************************************/
@SuppressWarnings("unchecked")
public BaseAction() {
	try {
		ParameterizedType type = (ParameterizedType) this.getClass()
				.getGenericSuperclass();
		clazz = (Class<?>) type.getActualTypeArguments()[0];
		model = (T) clazz.newInstance();
		log = Logger.getLogger(clazz);
	} catch (Exception e) {
		log.error(e.getMessage());
	}
}
 
Example 54
Project: s-store   File: VoltLog4jLogger.java   Source Code and License 5 votes vote down vote up
/**
 * Return a long containing the encoded status of every log level for the relevant loggers.
 * @return A long containing log levels for all the loggers available in the EE
 */
public long getLogLevels(VoltLogger[] voltloggers) {
    Logger[] loggers = new Logger[voltloggers.length];
    for (int i = 0; i < voltloggers.length; i++)
        loggers[i] = ((VoltLog4jLogger)voltloggers[i].m_logger).m_logger;

    long logLevels = 0;
    for (int ii = 0; ii < loggers.length; ii++) {
        final int level = loggers[ii].getEffectiveLevel().toInt();
        switch (level) {
        case org.apache.log4j.Level.TRACE_INT:
            logLevels |= trace << (ii * 3);
            break;
        case org.apache.log4j.Level.ALL_INT:
            logLevels |= all << (ii * 3);
            break;
        case org.apache.log4j.Level.DEBUG_INT:
            logLevels |= debug << (ii * 3);
            break;
        case org.apache.log4j.Level.ERROR_INT:
            logLevels |= error << (ii * 3);
            break;
        case org.apache.log4j.Level.FATAL_INT:
            logLevels |= fatal << (ii * 3);
            break;
        case org.apache.log4j.Level.INFO_INT:
            logLevels |= info << (ii * 3);
            break;
        case org.apache.log4j.Level.OFF_INT:
            logLevels |= off << (ii * 3);
            break;
        case org.apache.log4j.Level.WARN_INT:
            logLevels |= warn << (ii * 3);
            break;
            default:
                throw new RuntimeException("Unhandled log level " + level);
        }
    }
    return logLevels;
}
 
Example 55
Project: s-store   File: RingBufferAppender.java   Source Code and License 5 votes vote down vote up
public static Collection<LoggingEvent> getLoggingEvents(Logger...loggers) {
    SortedSet<LoggingEvent> events = new TreeSet<LoggingEvent>(new Comparator<LoggingEvent>() {
        @Override
        public int compare(LoggingEvent o1, LoggingEvent o2) {
            return (int)(o1.timeStamp - o2.timeStamp);
        }
    });
    for (Logger log : loggers) {
        RingBufferAppender rba = getRingBufferAppender(log);
        if (rba != null) {
            CollectionUtil.addAll(events, rba.getLogEvents());
        }
    } // FOR
    return (events);
}
 
Example 56
Project: s-store   File: LoggerUtil.java   Source Code and License 5 votes vote down vote up
/**
 * Flush the appenders for all of the active loggers
 */
public static void flushAllLogs() {
    LoggerRepository loggerRepo = LogManager.getLoggerRepository();
    for (Logger logger : CollectionUtil.iterable(loggerRepo.getCurrentLoggers(), Logger.class)) {
        LoggerUtil.flushLogs(logger);
    } // FOR
}
 
Example 57
Project: SparkSeq   File: GeneralPloidyFailOverAFCalculatorProvider.java   Source Code and License 5 votes vote down vote up
/**
 * Creates a new AF calculator provider given the genotyping arguments and logger reference.
 * @param genotypeArgs genotyping parameter collection.
 * @param logger where the AF calculator logging messages go. If {@code null}, logging message will not be emitted.
 *
 * @throws IllegalStateException if {@code genotypeArgs} is {@code null}.
 */
public GeneralPloidyFailOverAFCalculatorProvider(final GenotypeCalculationArgumentCollection genotypeArgs, final Logger logger) {
    if (genotypeArgs == null)
        throw new IllegalArgumentException("genotype arguments object cannot be null");
    preferredImplementation = AFCalculatorImplementation.bestValue(genotypeArgs.samplePloidy,genotypeArgs.MAX_ALTERNATE_ALLELES, null);
    preferred = preferredImplementation.newInstance();
    preferred.setLogger(logger);
    failOver = AFCalculatorImplementation.EXACT_GENERAL_PLOIDY.newInstance();
    failOver.setLogger(logger);
}
 
Example 58
Project: unitimes   File: ImportXmlFile.java   Source Code and License 5 votes vote down vote up
public static void main(String[] args) {
try {
	// Configure logging
       org.apache.log4j.PropertyConfigurator.configure(ApplicationProperties.getProperties());
       
       // Configure hibernate
       HibernateUtil.configureHibernate(ApplicationProperties.getProperties());
       
       // Load an XML file
       Document document = (new SAXReader()).read(new File(args[0]));
       
       // External id of the manager doing the import (can be null)
       String managerId = (args.length >= 2 ? args[1] : null);
       
       // Log writer to print messages from the import (can be null)
       DataExchangeHelper.LogWriter logger = new DataExchangeHelper.LogWriter() {
       	@Override
       	public void println(String message) {
       		Logger.getLogger(ImportXmlFile.class).info(message);
       	}
       };
       
       // Import document
       DataExchangeHelper.importDocument(document, managerId, logger);
       
       // Close hibernate
       HibernateUtil.closeHibernate();
} catch (Exception e) {
	Logger.getLogger(ImportXmlFile.class).error("Error: " +e.getMessage(), e);
}
  }
 
Example 59
Project: DIA-Umpire-Maven   File: DIAPack.java   Source Code and License 5 votes vote down vote up
public void ParsePepXML(DBSearchParam searchPara, LCMSID refID) throws ParserConfigurationException, SAXException, IOException, XmlPullParserException, ClassNotFoundException, InterruptedException {

        SetPepXMLPath();
        IDsummary = new LCMSID(FilenameUtils.getFullPath(Filename) + FilenameUtils.getBaseName(Filename), searchPara.DecoyPrefix, searchPara.FastaPath);
        for (String pepxml : iProphPepXMLs) {
            LCMSID pepxmlid = new LCMSID(FilenameUtils.getFullPath(Filename) + FilenameUtils.getBaseName(Filename), searchPara.DecoyPrefix, searchPara.FastaPath);
            PepXMLParser pepxmlparser = new PepXMLParser(pepxmlid, pepxml, 0f);
            if (refID == null) {
                pepxmlid.FilterByPepDecoyFDR(searchPara.DecoyPrefix, searchPara.PepFDR);
            }
            Logger.getRootLogger().info("No. of peptide ions:" + pepxmlid.GetPepIonList().size() + "; Peptide level threshold: " + pepxmlid.PepProbThreshold);
            for (PepIonID pepID : pepxmlid.GetPepIonList().values()) {
                if (refID != null) {
                    if (refID.GetPepIonList().containsKey(pepID.GetKey())) {
                        IDsummary.AddPeptideID(pepID);
                    }
                } else {
                    IDsummary.AddPeptideID(pepID);
                }
            }
        }
        IDsummary.ReMapProPep();
        Logger.getRootLogger().info("Total number of peptide ions:" + IDsummary.GetPepIonList().size());
        CheckPSMRT();
        if (MS1FeatureMap != null) {
            this.MS1FeatureMap.IDsummary = IDsummary;
        }
    }
 
Example 60
Project: DIA-Umpire-Maven   File: DIAPack.java   Source Code and License 5 votes vote down vote up
public void DIAMS2PeakDetection() throws SQLException, IOException, InterruptedException, ExecutionException, FileNotFoundException, Exception {
    int count = 1;
    //CreateSWATHTables();
    for (LCMSPeakDIAMS2 DIAwindow : DIAWindows) {
        Logger.getRootLogger().info("Processing DIA MS2 (mz range):" + DIAwindow.DIA_MZ_Range.getX() + "_" + DIAwindow.DIA_MZ_Range.getY() + "( " + (count++) + "/" + GetSpectrumParser().dIA_Setting.DIAWindows.size() + " )");
        DIAwindow.ExportPeakCurveTable = ExportFragmentPeak;
        DIAwindow.ExportPeakClusterTable = ExportPrecursorPeak;
        DIAwindow.PeakDetectionPFGrouping(MS1FeatureMap);
        DIAwindow.ClearAllPeaks();
        Logger.getRootLogger().info("==================================================================================");
    }
    RenameMGF("");
}