當前位置: 首頁>>代碼示例>>Java>>正文


Java Logger.isDebugEnabled方法代碼示例

本文整理匯總了Java中org.apache.logging.log4j.Logger.isDebugEnabled方法的典型用法代碼示例。如果您正苦於以下問題:Java Logger.isDebugEnabled方法的具體用法?Java Logger.isDebugEnabled怎麽用?Java Logger.isDebugEnabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.logging.log4j.Logger的用法示例。


在下文中一共展示了Logger.isDebugEnabled方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: filterPingResponses

import org.apache.logging.log4j.Logger; //導入方法依賴的package包/類
static List<ZenPing.PingResponse> filterPingResponses(List<ZenPing.PingResponse> fullPingResponses, boolean masterElectionIgnoreNonMasters, Logger logger) {
    List<ZenPing.PingResponse> pingResponses;
    if (masterElectionIgnoreNonMasters) {
        pingResponses = fullPingResponses.stream().filter(ping -> ping.node().isMasterNode()).collect(Collectors.toList());
    } else {
        pingResponses = fullPingResponses;
    }

    if (logger.isDebugEnabled()) {
        StringBuilder sb = new StringBuilder();
        if (pingResponses.isEmpty()) {
            sb.append(" {none}");
        } else {
            for (ZenPing.PingResponse pingResponse : pingResponses) {
                sb.append("\n\t--> ").append(pingResponse);
            }
        }
        logger.debug("filtered ping responses: (ignore_non_masters [{}]){}", masterElectionIgnoreNonMasters, sb);
    }
    return pingResponses;
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:22,代碼來源:ZenDiscovery.java

示例2: 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

示例3: checkJarHell

import org.apache.logging.log4j.Logger; //導入方法依賴的package包/類
/**
 * Checks the current classpath for duplicate classes
 * @throws IllegalStateException if jar hell was found
 */
public static void checkJarHell() throws IOException, URISyntaxException {
    ClassLoader loader = JarHell.class.getClassLoader();
    Logger logger = Loggers.getLogger(JarHell.class);
    if (logger.isDebugEnabled()) {
        logger.debug("java.class.path: {}", System.getProperty("java.class.path"));
        logger.debug("sun.boot.class.path: {}", System.getProperty("sun.boot.class.path"));
        if (loader instanceof URLClassLoader ) {
            logger.debug("classloader urls: {}", Arrays.toString(((URLClassLoader)loader).getURLs()));
         }
    }
    checkJarHell(parseClassPath());
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:17,代碼來源:JarHell.java

示例4: debug

import org.apache.logging.log4j.Logger; //導入方法依賴的package包/類
public static void debug(Class<?> clazz, String msg, Throwable t) {

		final Logger logger = LogManager.getLogger(clazz);
		if (logger.isDebugEnabled()) {
			logger.debug(msg, t);
		}
	}
 
開發者ID:EonTechnology,項目名稱:server,代碼行數:8,代碼來源:Loggers.java

示例5: 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


注:本文中的org.apache.logging.log4j.Logger.isDebugEnabled方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。