java类org.apache.log4j.Logger的实例源码

Command_TransformationMenu.java 文件源码 项目:voicemenu 阅读 17 收藏 0 点赞 0 评论 0
@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;
}
SPLGroungControlTest.java 文件源码 项目:SPLGroundControl 阅读 17 收藏 0 点赞 0 评论 0
@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();
}
RuleProcessors.java 文件源码 项目:Drones-Simulator 阅读 16 收藏 0 点赞 0 评论 0
@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!");
}
Command_TransformationMenu.java 文件源码 项目:voicemenu 阅读 16 收藏 0 点赞 0 评论 0
@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;
}
GraphOutput.java 文件源码 项目:Rubus 阅读 17 收藏 0 点赞 0 评论 0
/**
   * 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 + ".");
      }
    }
  }
TaskLog.java 文件源码 项目:hadoop 阅读 36 收藏 0 点赞 0 评论 0
@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);
  }
}
Activity_TransformationMenu.java 文件源码 项目:voicemenu 阅读 23 收藏 0 点赞 0 评论 0
@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;
}
HbaseConnectionWarehouse.java 文件源码 项目:worm 阅读 17 收藏 0 点赞 0 评论 0
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;
}
StartCheckpointEvent.java 文件源码 项目:ats-framework 阅读 15 收藏 0 点赞 0 评论 0
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;
}
UmpireSpecLibMatch.java 文件源码 项目:DIA-Umpire-Maven 阅读 17 收藏 0 点赞 0 评论 0
@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());
    }
}
iBenchDriver.java 文件源码 项目:ibench 阅读 24 收藏 0 点赞 0 评论 0
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")));
}
LCMSPeakDIAMS2.java 文件源码 项目:DIA-Umpire-Maven 阅读 26 收藏 0 点赞 0 评论 0
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;
}
UpdateTestcaseEvent.java 文件源码 项目:ats-framework 阅读 18 收藏 0 点赞 0 评论 0
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;
    }

}
Timeout_TransformationMenu.java 文件源码 项目:voicemenu 阅读 15 收藏 0 点赞 0 评论 0
@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;
}
Event_TransformationMenu.java 文件源码 项目:voicemenu 阅读 20 收藏 0 点赞 0 评论 0
@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;
}
iBenchDriver.java 文件源码 项目:ibench 阅读 23 收藏 0 点赞 0 评论 0
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);

}
Activity_TransformationMenu.java 文件源码 项目:voicemenu 阅读 54 收藏 0 点赞 0 评论 0
@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;
}
LanguageClassifier.java 文件源码 项目:Babler 阅读 18 收藏 0 点赞 0 评论 0
/**
 * 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);
        }
    }
}
AnnotationImporter.java 文件源码 项目:Rubus 阅读 22 收藏 0 点赞 0 评论 0
/**
 * 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);
  }
}
TestYarnClient.java 文件源码 项目:hadoop 阅读 19 收藏 0 点赞 0 评论 0
@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();
}
Log4JMetricsFileWriter.java 文件源码 项目:incubator-servicecomb-java-chassis 阅读 24 收藏 0 点赞 0 评论 0
@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);
}
LogMonitoring.java 文件源码 项目:ditb 阅读 15 收藏 0 点赞 0 评论 0
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;
}
JsonSourceMapperTestCase.java 文件源码 项目:siddhi-map-json 阅读 17 收藏 0 点赞 0 评论 0
@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();
}
DIA_Setting.java 文件源码 项目:DIA-Umpire-Maven 阅读 25 收藏 0 点赞 0 评论 0
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));
    }
}
iBench.java 文件源码 项目:ibench 阅读 16 收藏 0 点赞 0 评论 0
/**
 *  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);    
}
AbstractRipper.java 文件源码 项目:ripme 阅读 21 收藏 0 点赞 0 评论 0
/**
 * 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);
            }
        }
    }
}
Utils.java 文件源码 项目:gmusic-java 阅读 83 收藏 0 点赞 0 评论 0
/**
 * 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;
}
RingBufferAppender.java 文件源码 项目:s-store 阅读 21 收藏 0 点赞 0 评论 0
@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]))); 
}
RememberLoadQueueStateEvent.java 文件源码 项目:ats-framework 阅读 16 收藏 0 点赞 0 评论 0
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;
}
LogStep.java 文件源码 项目:convertigo-engine 阅读 18 收藏 0 点赞 0 评论 0
@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;
}


问题


面经


文章

微信
公众号

扫码关注公众号