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


Java Logger.isTraceEnabled方法代碼示例

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


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

示例1: traceMethod

import org.slf4j.Logger; //導入方法依賴的package包/類
@Around("(execution (public * org.jasig.cas..*.*(..))) && !(execution( * org.jasig.cas..*.set*(..)))")
public Object traceMethod(final ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
    Object returnVal = null;
    final Logger logger = this.getLog(proceedingJoinPoint);
    final String methodName = proceedingJoinPoint.getSignature().getName();

    try {
        if (logger.isTraceEnabled()) {
            final Object[] args = proceedingJoinPoint.getArgs();
            final String arguments;
            if (args == null || args.length == 0) {
                arguments = "";
            } else {
                arguments = Arrays.deepToString(args);
            }
            logger.trace("Entering method [{}] with arguments [{}]", methodName, arguments);
        }
        returnVal = proceedingJoinPoint.proceed();
        return returnVal;
    } finally {
        logger.trace("Leaving method [{}] with return value [{}].", methodName,
                    (returnVal != null ? returnVal.toString() : "null"));
    }
}
 
開發者ID:luotuo,項目名稱:cas4.0.x-server-wechat,代碼行數:25,代碼來源:LogAspect.java

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

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

示例4: runAndLog

import org.slf4j.Logger; //導入方法依賴的package包/類
static <THROWABLE extends Throwable> void runAndLog(
    Logger log, CheckedRunnable<THROWABLE> op, Supplier<String> opName)
    throws THROWABLE {
  try {
    op.run();
  } catch (Throwable t) {
    if (log.isTraceEnabled()) {
      log.trace("Failed to " + opName.get(), t);
    } else if (log.isWarnEnabled()){
      log.warn("Failed to " + opName.get() + ": " + t);
    }
    throw t;
  }

  if (log.isTraceEnabled()) {
    log.trace("Successfully ran " + opName.get());
  }
}
 
開發者ID:apache,項目名稱:incubator-ratis,代碼行數:19,代碼來源:LogUtils.java

示例5: supplyAndLog

import org.slf4j.Logger; //導入方法依賴的package包/類
static <OUTPUT, THROWABLE extends Throwable> OUTPUT supplyAndLog(
    Logger log, CheckedSupplier<OUTPUT, THROWABLE> supplier, Supplier<String> name)
    throws THROWABLE {
  final OUTPUT output;
  try {
    output = supplier.get();
  } catch (Throwable t) {
    if (log.isTraceEnabled()) {
      log.trace("Failed to " + name.get(), t);
    } else if (log.isWarnEnabled()){
      log.warn("Failed to " + name.get() + ": " + t);
    }
    throw (THROWABLE)t;
  }

  if (log.isTraceEnabled()) {
    log.trace("Successfully supplied " + name.get());
  }
  return output;
}
 
開發者ID:apache,項目名稱:incubator-ratis,代碼行數:21,代碼來源:LogUtils.java

示例6: marshall

import org.slf4j.Logger; //導入方法依賴的package包/類
/**
 * Marshall an XMLObject.  If the XMLObject already has a cached DOM via {@link XMLObject#getDOM()},
 * that Element will be returned.  Otherwise the object will be fully marshalled and that Element returned.
 * 
 * @param xmlObject the XMLObject to marshall
 * @return the marshalled Element
 * @throws MarshallingException if there is a problem marshalling the XMLObject
 */
public static Element marshall(XMLObject xmlObject) throws MarshallingException {
    Logger log = getLogger();
    log.debug("Marshalling XMLObject");
    
    if (xmlObject.getDOM() != null) {
        log.debug("XMLObject already had cached DOM, returning that element");
        return xmlObject.getDOM();
    }

    Marshaller marshaller = Configuration.getMarshallerFactory().getMarshaller(xmlObject);
    if (marshaller == null) {
        log.error("Unable to marshall XMLOBject, no marshaller registered for object: "
                + xmlObject.getElementQName());
    }
    
    Element messageElem = marshaller.marshall(xmlObject);
    
    if (log.isTraceEnabled()) {
        log.trace("Marshalled XMLObject into DOM:");
        log.trace(XMLHelper.nodeToString(messageElem));
    }
    
    return messageElem;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:33,代碼來源:XMLObjectHelper.java

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

示例8: renew

import org.slf4j.Logger; //導入方法依賴的package包/類
@Override
public void renew() {
    this.location.renew();
    this.nodes.clear();
    try {
        MplsNmsInventoryConnector conn = MplsNmsInventoryConnector.getInstance();
        Logger log = LoggerFactory.getLogger(LocationViewPage.class);
        for (NodeDto node : conn.getNodes()) {
            if (log.isTraceEnabled()) {
                log.trace("target: " + node.getName() + ":"
                        + (LocationUtil.getLocation(node) == null ?
                        "no-location" : LocationUtil.getLocation(node).getName()));
            }
            LocationDto loc = LocationUtil.getLocation(node);
            if (loc == null) {
                continue;
            } else if (DtoUtil.mvoEquals(this.location, loc)) {
                nodes.add(node);
            }
        }
    } catch (Exception e) {
        throw ExceptionUtils.throwAsRuntime(e);
    }
}
 
開發者ID:openNaEF,項目名稱:openNaEF,代碼行數:25,代碼來源:LocationViewPage.java

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

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

示例11: unmarshallFromInputStream

import org.slf4j.Logger; //導入方法依賴的package包/類
/**
 * Unmarshall a Document from an InputSteam.
 * 
 * @param parserPool the ParserPool instance to use
 * @param inputStream the InputStream to unmarshall
 * @return the unmarshalled XMLObject
 * @throws XMLParserException if there is a problem parsing the input data
 * @throws UnmarshallingException if there is a problem unmarshalling the parsed DOM
 */
public static XMLObject unmarshallFromInputStream(ParserPool parserPool, InputStream inputStream)
        throws XMLParserException, UnmarshallingException {
    Logger log = getLogger();
    log.debug("Parsing InputStream into DOM document");

    Document messageDoc = parserPool.parse(inputStream);
    Element messageElem = messageDoc.getDocumentElement();

    if (log.isTraceEnabled()) {
        log.trace("Resultant DOM message was:");
        log.trace(XMLHelper.nodeToString(messageElem));
    }

    log.debug("Unmarshalling DOM parsed from InputStream");
    Unmarshaller unmarshaller = Configuration.getUnmarshallerFactory().getUnmarshaller(messageElem);
    if (unmarshaller == null) {
        log.error("Unable to unmarshall InputStream, no unmarshaller registered for element "
                + XMLHelper.getNodeQName(messageElem));
        throw new UnmarshallingException(
                "Unable to unmarshall InputStream, no unmarshaller registered for element "
                        + XMLHelper.getNodeQName(messageElem));
    }

    XMLObject message = unmarshaller.unmarshall(messageElem);

    log.debug("InputStream succesfully unmarshalled");
    return message;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:38,代碼來源:XMLObjectHelper.java

示例12: unmarshallFromReader

import org.slf4j.Logger; //導入方法依賴的package包/類
/**
 * Unmarshall a Document from a Reader.
 * 
 * @param parserPool the ParserPool instance to use
 * @param reader the Reader to unmarshall
 * @return the unmarshalled XMLObject
 * @throws XMLParserException if there is a problem parsing the input data
 * @throws UnmarshallingException if there is a problem unmarshalling the parsed DOM
 */
public static XMLObject unmarshallFromReader(ParserPool parserPool, Reader reader)
        throws XMLParserException, UnmarshallingException {
    Logger log = getLogger();
    log.debug("Parsing Reader into DOM document");
    

    Document messageDoc = parserPool.parse(reader);
    Element messageElem = messageDoc.getDocumentElement();

    if (log.isTraceEnabled()) {
        log.trace("Resultant DOM message was:");
        log.trace(XMLHelper.nodeToString(messageElem));
    }

    log.debug("Unmarshalling DOM parsed from Reader");
    Unmarshaller unmarshaller = Configuration.getUnmarshallerFactory().getUnmarshaller(messageElem);
    if (unmarshaller == null) {
        log.error("Unable to unmarshall Reader, no unmarshaller registered for element "
                + XMLHelper.getNodeQName(messageElem));
        throw new UnmarshallingException(
                "Unable to unmarshall Reader, no unmarshaller registered for element "
                        + XMLHelper.getNodeQName(messageElem));
    }

    XMLObject message = unmarshaller.unmarshall(messageElem);

    log.debug("Reader succesfully unmarshalled");
    return message;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:39,代碼來源:XMLObjectHelper.java

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

示例14: trace

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

public static void trace(Logger logger, String message, Object... params) {

	if (logger.isTraceEnabled()) {
		logger.trace(message, params);
	}
}
 
開發者ID:allianzit,項目名稱:ait-platform,代碼行數:14,代碼來源:AitLogger.java

示例15: enabled

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


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