本文整理汇总了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));
}
}