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