当前位置: 首页>>代码示例>>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;未经允许,请勿转载。