本文整理匯總了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);
}
}
示例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;
}
示例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;
}
}
示例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());
}
};
}
示例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;
}
示例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);
}
}
示例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;
}
示例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();
}
示例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);
}
}
示例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---");
}
}
}
示例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);
}
}
}
示例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));
}
}
示例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;
}
示例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;
}
示例15: consoleDebug
import org.slf4j.Logger; //導入方法依賴的package包/類
public static void consoleDebug(Logger logger, ScriptObjectMirror args) {
if (logger.isDebugEnabled()) {
logger.debug(logMessage(args));
}
}