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


Java Logger.isInfoEnabled方法代码示例

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


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

示例1: logGcOverhead

import org.apache.logging.log4j.Logger; //导入方法依赖的package包/类
static void logGcOverhead(
    final Logger logger,
    final JvmMonitor.Threshold threshold,
    final long current,
    final long elapsed,
    final long seq) {
    switch (threshold) {
        case WARN:
            if (logger.isWarnEnabled()) {
                logger.warn(OVERHEAD_LOG_MESSAGE, seq, TimeValue.timeValueMillis(current), TimeValue.timeValueMillis(elapsed));
            }
            break;
        case INFO:
            if (logger.isInfoEnabled()) {
                logger.info(OVERHEAD_LOG_MESSAGE, seq, TimeValue.timeValueMillis(current), TimeValue.timeValueMillis(elapsed));
            }
            break;
        case DEBUG:
            if (logger.isDebugEnabled()) {
                logger.debug(OVERHEAD_LOG_MESSAGE, seq, TimeValue.timeValueMillis(current), TimeValue.timeValueMillis(elapsed));
            }
            break;
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:25,代码来源:JvmGcMonitorService.java

示例2: logSlowGc

import org.apache.logging.log4j.Logger; //导入方法依赖的package包/类
static void logSlowGc(
    final Logger logger,
    final JvmMonitor.Threshold threshold,
    final long seq,
    final JvmMonitor.SlowGcEvent slowGcEvent,
    BiFunction<JvmStats, JvmStats, String> pools) {

    final String name = slowGcEvent.currentGc.getName();
    final long elapsed = slowGcEvent.elapsed;
    final long totalGcCollectionCount = slowGcEvent.currentGc.getCollectionCount();
    final long currentGcCollectionCount = slowGcEvent.collectionCount;
    final TimeValue totalGcCollectionTime = slowGcEvent.currentGc.getCollectionTime();
    final TimeValue currentGcCollectionTime = slowGcEvent.collectionTime;
    final JvmStats lastJvmStats = slowGcEvent.lastJvmStats;
    final JvmStats currentJvmStats = slowGcEvent.currentJvmStats;
    final ByteSizeValue maxHeapUsed = slowGcEvent.maxHeapUsed;

    switch (threshold) {
        case WARN:
            if (logger.isWarnEnabled()) {
                logger.warn(
                    SLOW_GC_LOG_MESSAGE,
                    name,
                    seq,
                    totalGcCollectionCount,
                    currentGcCollectionTime,
                    currentGcCollectionCount,
                    TimeValue.timeValueMillis(elapsed),
                    currentGcCollectionTime,
                    totalGcCollectionTime,
                    lastJvmStats.getMem().getHeapUsed(),
                    currentJvmStats.getMem().getHeapUsed(),
                    maxHeapUsed,
                    pools.apply(lastJvmStats, currentJvmStats));
            }
            break;
        case INFO:
            if (logger.isInfoEnabled()) {
                logger.info(
                    SLOW_GC_LOG_MESSAGE,
                    name,
                    seq,
                    totalGcCollectionCount,
                    currentGcCollectionTime,
                    currentGcCollectionCount,
                    TimeValue.timeValueMillis(elapsed),
                    currentGcCollectionTime,
                    totalGcCollectionTime,
                    lastJvmStats.getMem().getHeapUsed(),
                    currentJvmStats.getMem().getHeapUsed(),
                    maxHeapUsed,
                    pools.apply(lastJvmStats, currentJvmStats));
            }
            break;
        case DEBUG:
            if (logger.isDebugEnabled()) {
                logger.debug(
                    SLOW_GC_LOG_MESSAGE,
                    name,
                    seq,
                    totalGcCollectionCount,
                    currentGcCollectionTime,
                    currentGcCollectionCount,
                    TimeValue.timeValueMillis(elapsed),
                    currentGcCollectionTime,
                    totalGcCollectionTime,
                    lastJvmStats.getMem().getHeapUsed(),
                    currentJvmStats.getMem().getHeapUsed(),
                    maxHeapUsed,
                    pools.apply(lastJvmStats, currentJvmStats));
            }
            break;
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:75,代码来源:JvmGcMonitorService.java

示例3: info

import org.apache.logging.log4j.Logger; //导入方法依赖的package包/类
public static void info(Class<?> clazz, String message) {

		final Logger logger = LogManager.getLogger(clazz);
		if (logger.isInfoEnabled())
			logger.info(message);
	}
 
开发者ID:EonTechnology,项目名称:server,代码行数:7,代码来源:Loggers.java


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