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


Java Logger.isInfoEnabled方法代碼示例

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


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

示例1: logThreadInfo

import org.slf4j.Logger; //導入方法依賴的package包/類
public static void logThreadInfo(Logger log, String title, long minInterval) {
  boolean dumpStack = false;
  if (log.isInfoEnabled()) {
    synchronized (ReflectionUtils.class) {
      long now = System.currentTimeMillis();
      if (now - previousLogTime >= minInterval * 1000L) {
        previousLogTime = now;
        dumpStack = true;
      }
    }
    if (dumpStack) {
      ByteArrayOutputStream buffer = new ByteArrayOutputStream();
      printThreadInfo(new PrintWriter(buffer), title);
      log.info(buffer.toString());
    }
  }
}
 
開發者ID:Tencent,項目名稱:angel,代碼行數:18,代碼來源:ReflectionUtils.java

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

示例3: logException

import org.slf4j.Logger; //導入方法依賴的package包/類
/**
 * Writes an exception log.
 *
 * @param code   message code involved
 * @param locale the locale involved
 * @param ex     the exception to log
 * @param logger the logger to log to
 */
protected void logException(String code,
		Locale locale,
		Exception ex,
		Logger logger) {
	if (logger.isInfoEnabled()) {
		StringBuilder sb = new StringBuilder();
		sb.append("FAILED: resolveCode [");
		sb.append(code);
		sb.append("] for language [");
		sb.append(locale.toString());
		sb.append("] because of: ");
		sb.append(ex.getClass().getName());
		sb.append("Message:");
		sb.append(ex.getMessage() != null ? ex.getMessage().replaceAll("\n", " ") : "null");
		logger.info(sb.toString());
	}
}
 
開發者ID:namics,項目名稱:spring-i18n-support,代碼行數:26,代碼來源:AbstractDaoMessageSource.java

示例4: dump

import org.slf4j.Logger; //導入方法依賴的package包/類
/**
 * 記錄請求信息
 * 
 * @param methodInvocation
 * @param take
 */
private void dump(MethodInvocation methodInvocation, Object result, long take) {
    // 取得日誌打印對象
    Logger log = getLogger(methodInvocation.getMethod().getDeclaringClass());
    Object[] args = methodInvocation.getArguments();
    StringBuffer buffer = getArgsString(args);

    if (log.isInfoEnabled()) {
        String className = ClassUtils.getShortClassName(methodInvocation.getMethod().getDeclaringClass());
        String methodName = methodInvocation.getMethod().getName();
        String resultStr = getResultString(result);

        String now = new SimpleDateFormat(DATA_FORMAT).format(new Date());
        log.info(MessageFormat.format(MESSAGE, new Object[] { className, methodName, now, take, buffer.toString(),
                resultStr }));
    }
}
 
開發者ID:luoyaogui,項目名稱:otter-G,代碼行數:23,代碼來源:LogInterceptor.java

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

示例6: log

import org.slf4j.Logger; //導入方法依賴的package包/類
@Override
public LogEvent log(LogEvent ev)
{
    final String clsName = ev.getRealm().replace('/', ':');
    Logger logger = LoggerFactory.getLogger(prefix == null ? clsName : prefix + "." + clsName);

    if (logger.isInfoEnabled())
    {
        ByteArrayOutputStream w = new ByteArrayOutputStream();
        PrintStream p = new PrintStream(w);
        ev.dump(p, "");
        logger.info("| \n" + (w.toString().trim()));
    }
    return ev;
}
 
開發者ID:vmantek,項目名稱:chimera,代碼行數:16,代碼來源:ChimeraLogListener.java

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

示例8: configure

import org.slf4j.Logger; //導入方法依賴的package包/類
protected void configure(HttpSecurity http) throws Exception {
    http.authorizeRequests()
            .antMatchers("/api/users/**").hasRole("ADMIN")
            .antMatchers("/api/session").permitAll()
            .antMatchers(HttpMethod.GET).permitAll()
            .antMatchers("/api/**").hasRole("BASIC");

    http.addFilterAfter(new CsrfTokenResponseHeaderBindingFilter(), CsrfFilter.class);

    Logger logger = LoggerFactory.getLogger(getClass());
    if (logger.isInfoEnabled()) {
        logger.info("設置安全策略");
    }
}
 
開發者ID:mingzuozhibi,項目名稱:mzzb-server,代碼行數:15,代碼來源:SecurityConfig.java

示例9: fetchSakuraSpeedData

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

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

示例11: info

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

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

示例12: getLogLevel

import org.slf4j.Logger; //導入方法依賴的package包/類
public static LogLevel getLogLevel( Logger logger ) {
    if( logger.isTraceEnabled() )
        return LogLevel.TRACE;
    else if( logger.isDebugEnabled() )
        return LogLevel.DEBUG;
    else if( logger.isInfoEnabled() )
        return LogLevel.INFO;
    else if( logger.isWarnEnabled() )
        return LogLevel.WARN;
    else if( logger.isErrorEnabled() )
        return LogLevel.ERROR;

    return LogLevel.NONE;
}
 
開發者ID:tenable,項目名稱:Tenable.io-SDK-for-Java,代碼行數:15,代碼來源:LoggerHelper.java

示例13: info

import org.slf4j.Logger; //導入方法依賴的package包/類
public static void info(Logger logger,String format,Supplier<Object> supplier){
    if(logger.isInfoEnabled()){
        logger.info(format,supplier.get());
    }
}
 
開發者ID:yu199195,項目名稱:happylifeplat-transaction,代碼行數:6,代碼來源:LogUtil.java

示例14: enabled

import org.slf4j.Logger; //導入方法依賴的package包/類
@Override
public boolean enabled(Logger logger) {
    return logger.isInfoEnabled();
}
 
開發者ID:soabase,項目名稱:soabase-stages,代碼行數:5,代碼來源:Slf4JTracing.java

示例15: consoleInfo

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


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