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


Java Logger.isDebugEnabled方法代碼示例

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


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

示例1: responseObject

import org.slf4j.Logger; //導入方法依賴的package包/類
private void responseObject(WObject wObject, PorterOfFun porterOfFun, Object object, boolean nullClose)
{
    if (object != null)
    {
        Logger LOGGER = logger(wObject);

        if (object != null && object instanceof JResponse && ((JResponse) object).isNotSuccess())
        {
            wObject.getResponse().toErr();
            if (LOGGER.isDebugEnabled())
            {
                LOGGER.debug("{}:{}", wObject.url(), object);

            } else if (LOGGER.isInfoEnabled())
            {
                LOGGER.info("{}:{}", wObject.url(), object);
            }
        }
        doFinalWrite(wObject, porterOfFun, object);
        close(wObject);
    } else if (nullClose)
    {
        close(wObject);
    }
}
 
開發者ID:gzxishan,項目名稱:OftenPorter,代碼行數:26,代碼來源:PortExecutor.java

示例2: getLoggerLevel

import org.slf4j.Logger; //導入方法依賴的package包/類
public static int getLoggerLevel(Logger logger) {
    if (logger == null) {
        throw new NullPointerException("logger must not be null");
    }
    if (logger.isTraceEnabled()) {
        return TRACE_LEVEL;
    }
    if (logger.isDebugEnabled()) {
        return DEBUG_LEVEL;
    }
    if (logger.isInfoEnabled()) {
        return INFO_LEVEL;
    }
    if (logger.isWarnEnabled()) {
        return WARN_LEVEL;
    }
    if (logger.isErrorEnabled()) {
        return ERROR_LEVEL;
    }
    return DISABLE_LEVEL;
}
 
開發者ID:fchenxi,項目名稱:easyhbase,代碼行數:22,代碼來源:LoggerUtils.java

示例3: onLog

import org.slf4j.Logger; //導入方法依賴的package包/類
@Override
public void onLog(SimpleLog simpleLog, SimpleLog.Level logLevel, Object message) {
	Logger log = convert(simpleLog);
	switch (logLevel) {
		case TRACE:
			if (log.isTraceEnabled()) {
				log.trace(message.toString());
			}
			break;
		case DEBUG:
			if (log.isDebugEnabled()) {
				log.debug(message.toString());
			}
			break;
		case INFO:
			log.info(message.toString());
			break;
		case WARNING:
			log.warn(message.toString());
			break;
		case FATAL:
			log.error(message.toString());
			break;
	}
}
 
開發者ID:Mantaro,項目名稱:MantaroRPG,代碼行數:26,代碼來源:SimpleLogToSLF4JAdapter.java

示例4: NettyClientHandler

import org.slf4j.Logger; //導入方法依賴的package包/類
public NettyClientHandler(String id, int epoch, String protocol, int affinity, T login, Integer connTimeout, long idleTimeout,
    Logger log, NettyMetricsSink metrics, NettyClient<T> client, NetworkClientCallback<T> callback) {
    this.log = log;
    this.id = id;
    this.epoch = epoch;
    this.protocol = protocol;
    this.affinity = affinity;
    this.login = login;
    this.idleTimeout = idleTimeout;
    this.connTimeout = connTimeout;
    this.metrics = metrics;
    this.client = client;
    this.callback = callback;

    this.debug = log.isDebugEnabled();
    this.trace = log.isTraceEnabled();

    hbOnFlush = future -> {
        hbFlushed = true;

        if (!future.isSuccess() && future.channel().isOpen()) {
            future.channel().pipeline().fireExceptionCaught(future.cause());
        }
    };
}
 
開發者ID:hekate-io,項目名稱:hekate,代碼行數:26,代碼來源:NettyClientHandler.java

示例5: isLogLevelEnabled

import org.slf4j.Logger; //導入方法依賴的package包/類
/**
 * check if log level is enabled in the underlying logger
 *
 * @param underlyingLogger real Slf4j Logger implementation
 * @param logLevel log level
 * @param marker marker
 * @return true if log level is enabled or false.
 */
public static boolean isLogLevelEnabled(Logger underlyingLogger, Level logLevel, Marker marker) {
    switch (logLevel) {
        case TRACE:
            if (marker == null) {
                return underlyingLogger.isTraceEnabled();
            }
            return underlyingLogger.isTraceEnabled(marker);
        case DEBUG:
            if (marker == null) {
                return underlyingLogger.isDebugEnabled();
            }
            return underlyingLogger.isDebugEnabled(marker);
        case INFO:
            if (marker == null) {
                return underlyingLogger.isInfoEnabled();
            }
            return underlyingLogger.isInfoEnabled(marker);
        case WARN:
            if (marker == null) {
                return underlyingLogger.isWarnEnabled();
            }
            return underlyingLogger.isWarnEnabled(marker);
        case ERROR:
            if (marker == null) {
                return underlyingLogger.isErrorEnabled();
            }
            return underlyingLogger.isErrorEnabled(marker);
        default:
            break;
    }
    return false;
}
 
開發者ID:kwon37xi,項目名稱:slf4j-lambda,代碼行數:41,代碼來源:LambdaLoggerUtils.java

示例6: debug

import org.slf4j.Logger; //導入方法依賴的package包/類
/**
 * debug
 * @param logger
 * @param message
 * @param params
 */

public static void debug(Logger logger, String message, Object... params) {
	
	if (logger.isDebugEnabled()) {
		logger.debug(message, params);
	}
}
 
開發者ID:allianzit,項目名稱:ait-platform,代碼行數:14,代碼來源:AitLogger.java

示例7: obtainLock

import org.slf4j.Logger; //導入方法依賴的package包/類
/**
 * Grants a lock on the identified resource to the calling thread (blocking
 * until it is available).
 * 
 * @return true if the lock was obtained.
 */
public boolean obtainLock(Connection conn, String lockName)
    throws LockException {

    lockName = lockName.intern();

    Logger log = getLog();
    
    if(log.isDebugEnabled()) {
        log.debug(
            "Lock '" + lockName + "' is desired by: "
                    + Thread.currentThread().getName());
    }
    if (!isLockOwner(conn, lockName)) {

        executeSQL(conn, lockName, expandedSQL);
        
        if(log.isDebugEnabled()) {
            log.debug(
                "Lock '" + lockName + "' given to: "
                        + Thread.currentThread().getName());
        }
        getThreadLocks().add(lockName);
        //getThreadLocksObtainer().put(lockName, new
        // Exception("Obtainer..."));
    } else if(log.isDebugEnabled()) {
        log.debug(
            "Lock '" + lockName + "' Is already owned by: "
                    + Thread.currentThread().getName());
    }

    return true;
}
 
開發者ID:AsuraTeam,項目名稱:asura,代碼行數:39,代碼來源:DBSemaphore.java

示例8: NettyClientDeferHandler

import org.slf4j.Logger; //導入方法依賴的package包/類
public NettyClientDeferHandler(String id, Logger log) {
    this.id = id;
    this.log = log;

    this.debug = log.isDebugEnabled();
    this.trace = log.isTraceEnabled();
}
 
開發者ID:hekate-io,項目名稱:hekate,代碼行數:8,代碼來源:NettyClientDeferHandler.java

示例9: configureLogging

import org.slf4j.Logger; //導入方法依賴的package包/類
private void configureLogging(ApiClient apiClient) {
    // Add logging interceptor to HTTP Client if Debug is enabled. Make it configurable?
    Logger logger = LoggerFactory.getLogger(PUBLICApi.class);
    if (logger.isDebugEnabled()) {
        HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor(new HttpLoggingInterceptor.Logger() {
            @Override
            public void log(String msg) {
                logger.debug(msg);
            }
        });
        loggingInterceptor.setLevel(Level.BODY);
        apiClient.getOkBuilder().addNetworkInterceptor(loggingInterceptor);
    }
}
 
開發者ID:dfrommi,項目名稱:openhab-tado,代碼行數:15,代碼來源:TadoApiClientFactory.java

示例10: logBodyString

import org.slf4j.Logger; //導入方法依賴的package包/類
@Override
public void logBodyString(String bodyString, Logger log) {
  if (log.isDebugEnabled()) {
    if (bodyString!=null) {
      BufferedReader reader = new BufferedReader(new StringReader(bodyString));
      reader.lines().forEach(line->log.debug("  "+line));
    } else {
      log.debug("  ---body-is-null---");
    }
  }
}
 
開發者ID:rockscript,項目名稱:rockscript,代碼行數:12,代碼來源:ServerRequest.java

示例11: fetchAmazonDiscsData

import org.slf4j.Logger; //導入方法依賴的package包/類
private void fetchAmazonDiscsData(int retry) {
    Logger logger = LoggerFactory.getLogger(AutoRunConfig.class);
    if (retry == 0) {
        if (logger.isWarnEnabled()) {
            logger.warn("fetching amazon discs data failed");
        }
    } else {
        if (logger.isInfoEnabled()) {
            logger.info("fetching amazon discs data ({})", retry);
        }
        try {
            amazonDiscsSpider.fetch();
        } catch (IOException e) {
            if (logger.isDebugEnabled()) {
                logger.debug("fetching amazon discs data throw an error", e);
            }
            if (retry > 0) {
                fetchSakuraSpeedData(retry - 1);
            } else {
                return;
            }
        }
        if (logger.isInfoEnabled()) {
            logger.info("fetched amazon discs data ({})", retry);
        }
    }
}
 
開發者ID:mingzuozhibi,項目名稱:mzzb-server,代碼行數:28,代碼來源:AutoRunConfig.java

示例12: log

import org.slf4j.Logger; //導入方法依賴的package包/類
protected static void log(final String name, final RelNode node, final Logger logger) {
  if (logger.isDebugEnabled()) {
    logger.debug(name + " : \n" + RelOptUtil.toString(node, SqlExplainLevel.ALL_ATTRIBUTES));
  }
}
 
開發者ID:skhalifa,項目名稱:QDrill,代碼行數:6,代碼來源:DefaultSqlHandler.java

示例13: obtainLock

import org.slf4j.Logger; //導入方法依賴的package包/類
/**
 * Grants a lock on the identified resource to the calling thread (blocking
 * until it is available).
 * 
 * @return true if the lock was obtained.
 */
public synchronized boolean obtainLock(Connection conn, String lockName) {

    lockName = lockName.intern();

    Logger log = getLog();

    if(log.isDebugEnabled()) {
        log.debug(
            "Lock '" + lockName + "' is desired by: "
                    + Thread.currentThread().getName());
    }

    if (!isLockOwner(conn, lockName)) {
        if(log.isDebugEnabled()) {
            log.debug(
                "Lock '" + lockName + "' is being obtained: "
                        + Thread.currentThread().getName());
        }
        while (locks.contains(lockName)) {
            try {
                this.wait();
            } catch (InterruptedException ie) {
                if(log.isDebugEnabled()) {
                    log.debug(
                        "Lock '" + lockName + "' was not obtained by: "
                                + Thread.currentThread().getName());
                }
            }
        }

        if(log.isDebugEnabled()) {
            log.debug(
                "Lock '" + lockName + "' given to: "
                        + Thread.currentThread().getName());
        }
        getThreadLocks().add(lockName);
        locks.add(lockName);
    } else if(log.isDebugEnabled()) {
        log.debug(
            "Lock '" + lockName + "' already owned by: "
                    + Thread.currentThread().getName()
                    + " -- but not owner!",
            new Exception("stack-trace of wrongful returner"));
    }

    return true;
}
 
開發者ID:AsuraTeam,項目名稱:asura,代碼行數:54,代碼來源:SimpleSemaphore.java

示例14: obtainLock

import org.slf4j.Logger; //導入方法依賴的package包/類
/**
 * Grants a lock on the identified resource to the calling thread (blocking
 * until it is available).
 * 
 * @return true if the lock was obtained.
 */
public synchronized boolean obtainLock(Connection conn, String lockName) throws LockException {

    lockName = lockName.intern();

    Logger log = getLog();

    if(log.isDebugEnabled()) {
        log.debug(
            "Lock '" + lockName + "' is desired by: "
                    + Thread.currentThread().getName());
    }

    if (!isLockOwner(conn, lockName)) {
        if(log.isDebugEnabled()) {
            log.debug(
                "Lock '" + lockName + "' is being obtained: "
                        + Thread.currentThread().getName());
        }
        
        while (locks.contains(lockName)) {
            try {
                this.wait();
            } catch (InterruptedException ie) {
                if(log.isDebugEnabled()) {
                    log.debug(
                        "Lock '" + lockName + "' was not obtained by: "
                                + Thread.currentThread().getName());
                }
            }
        }

        // If we are in a transaction, register a callback to actually release
        // the lock when the transaction completes
        Transaction t = getTransaction();
        if (t != null) {
            try {
                t.registerSynchronization(new SemaphoreSynchronization(lockName));
            } catch (Exception e) {
                throw new LockException("Failed to register semaphore with Transaction.", e);
            }
        }
        
        if(log.isDebugEnabled()) {
            log.debug(
                "Lock '" + lockName + "' given to: "
                        + Thread.currentThread().getName());
        }
        
        
        getThreadLocks().add(lockName);
        locks.add(lockName);
    } else if(log.isDebugEnabled()) {
        log.debug(
            "Lock '" + lockName + "' already owned by: "
                    + Thread.currentThread().getName()
                    + " -- but not owner!",
            new Exception("stack-trace of wrongful returner"));
    }

    return true;
}
 
開發者ID:AsuraTeam,項目名稱:asura,代碼行數:68,代碼來源:JTANonClusteredSemaphore.java

示例15: consoleDebug

import org.slf4j.Logger; //導入方法依賴的package包/類
public static void consoleDebug(Logger logger, ScriptObjectMirror args) {
    if (logger.isDebugEnabled()) {
        logger.debug(logMessage(args));
    }
}
 
開發者ID:line,項目名稱:centraldogma,代碼行數:6,代碼來源:Polyfills.java


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