当前位置: 首页>>代码示例>>Java>>正文


Java Logger类代码示例

本文整理汇总了Java中org.apache.log4j.Logger的典型用法代码示例。如果您正苦于以下问题:Java Logger类的具体用法?Java Logger怎么用?Java Logger使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Logger类属于org.apache.log4j包,在下文中一共展示了Logger类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createItem

import org.apache.log4j.Logger; //导入依赖的package包/类
@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;
}
 
开发者ID:vaclav,项目名称:voicemenu,代码行数:20,代码来源:Command_TransformationMenu.java

示例2: setUpClass

import org.apache.log4j.Logger; //导入依赖的package包/类
@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();
}
 
开发者ID:envirover,项目名称:SPLGroundControl,代码行数:18,代码来源:SPLGroungControlTest.java

示例3: run

import org.apache.log4j.Logger; //导入依赖的package包/类
@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!");
}
 
开发者ID:INAETICS,项目名称:Drones-Simulator,代码行数:23,代码来源:RuleProcessors.java

示例4: outputMethod

import org.apache.log4j.Logger; //导入依赖的package包/类
/**
   * 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 + ".");
      }
    }
  }
 
开发者ID:adnanmitf09,项目名称:Rubus,代码行数:26,代码来源:GraphOutput.java

示例5: syncLogs

import org.apache.log4j.Logger; //导入依赖的package包/类
@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);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:19,代码来源:TaskLog.java

示例6: createItem

import org.apache.log4j.Logger; //导入依赖的package包/类
@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;
}
 
开发者ID:vaclav,项目名称:voicemenu,代码行数:20,代码来源:Activity_TransformationMenu.java

示例7: HbaseConnectionWarehouse

import org.apache.log4j.Logger; //导入依赖的package包/类
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;
}
 
开发者ID:husky00,项目名称:worm,代码行数:20,代码来源:HbaseConnectionWarehouse.java

示例8: StartCheckpointEvent

import org.apache.log4j.Logger; //导入依赖的package包/类
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;
}
 
开发者ID:Axway,项目名称:ats-framework,代码行数:18,代码来源:StartCheckpointEvent.java

示例9: run

import org.apache.log4j.Logger; //导入依赖的package包/类
@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());
    }
}
 
开发者ID:YcheCourseProject,项目名称:DIA-Umpire-Maven,代码行数:18,代码来源:UmpireSpecLibMatch.java

示例10: setUpConfigLogger

import org.apache.log4j.Logger; //导入依赖的package包/类
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")));
}
 
开发者ID:RJMillerLab,项目名称:ibench,代码行数:17,代码来源:iBenchDriver.java

示例11: FSCluster2CurveUnfragRead

import org.apache.log4j.Logger; //导入依赖的package包/类
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;
}
 
开发者ID:YcheCourseProject,项目名称:DIA-Umpire-Maven,代码行数:19,代码来源:LCMSPeakDIAMS2.java

示例12: UpdateTestcaseEvent

import org.apache.log4j.Logger; //导入依赖的package包/类
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;
    }

}
 
开发者ID:Axway,项目名称:ats-framework,代码行数:21,代码来源:UpdateTestcaseEvent.java

示例13: createItem

import org.apache.log4j.Logger; //导入依赖的package包/类
@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;
}
 
开发者ID:vaclav,项目名称:voicemenu,代码行数:20,代码来源:Timeout_TransformationMenu.java

示例14: createItem

import org.apache.log4j.Logger; //导入依赖的package包/类
@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;
}
 
开发者ID:vaclav,项目名称:voicemenu,代码行数:20,代码来源:Event_TransformationMenu.java

示例15: setUpExperimentalLogger

import org.apache.log4j.Logger; //导入依赖的package包/类
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);
	
}
 
开发者ID:RJMillerLab,项目名称:ibench,代码行数:21,代码来源:iBenchDriver.java


注:本文中的org.apache.log4j.Logger类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。