Example usage for org.apache.commons.logging Log isTraceEnabled

List of usage examples for org.apache.commons.logging Log isTraceEnabled

Introduction

In this page you can find the example usage for org.apache.commons.logging Log isTraceEnabled.

Prototype

boolean isTraceEnabled();

Source Link

Document

Is trace logging currently enabled?

Usage

From source file:LoggingTrial.java

public static void main(String[] args) {
    Log log = LogFactory.getLog(LoggingTrial.class);
    System.out.println("The Log being used >>> " + log);

    Exception e = new Exception("A DUMMY EXCEPTION");
    if (log.isTraceEnabled()) {
        log.trace("TRACE TEST");
        log.trace("TRACE TEST", e);
    }//  w w w .  j  a va2s  .c  om
    if (log.isDebugEnabled()) {
        log.debug("DEBUG TEST");
        log.debug("DEBUG TEST", e);
    }

    if (log.isInfoEnabled()) {
        log.info("INFO TEST");
        log.info("INFO TEST", e);
    }
    if (log.isWarnEnabled()) {
        log.warn("WARN TEST");
        log.warn("WARN TEST", e);
    }

    if (log.isErrorEnabled()) {
        log.error("ERROR TEST");
        log.error("ERROR TEST", e);
    }

    if (log.isFatalEnabled()) {
        log.fatal("FATAL TEST");
        log.fatal("FATAL TEST", e);
    }
}

From source file:net.lightbody.bmp.proxy.jetty.util.LogSupport.java

/**
 * Ignore an exception unless trace is enabled.
 * This works around the problem that log4j does not support the trace level.
 *//*from   w ww.  ja  v a 2  s. c  o m*/
public static void ignore(Log log, Throwable th) {
    if (log.isTraceEnabled())
        log.trace(IGNORED, th);
}

From source file:com.joliciel.talismane.utils.LogUtils.java

/**
 * Log the available runtime memory.// w w  w .j av  a 2s. c  o m
 */
public static void logMemory(Log logger) {
    if (logger.isTraceEnabled()) {
        //Getting the runtime reference from system
        Runtime runtime = Runtime.getRuntime();
        logger.trace("##### Heap utilization statistics [MB] #####");

        //Print used memory
        logger.trace("Used Memory:" + (runtime.totalMemory() - runtime.freeMemory()) / MEGABYTE);

        //Print free memory
        logger.trace("Free Memory:" + runtime.freeMemory() / MEGABYTE);

        //Print total available memory
        logger.trace("Total Memory:" + runtime.totalMemory() / MEGABYTE);

        //Print Maximum available memory
        logger.trace("Max Memory:" + runtime.maxMemory() / MEGABYTE);
    }
}

From source file:com.joliciel.talismane.utils.DaoUtils.java

public static void LogParameters(Map<String, Object> paramMap, Log log) {
    if (log.isTraceEnabled()) {
        for (Object obj : paramMap.entrySet()) {
            @SuppressWarnings("rawtypes")
            Entry entry = (Entry) obj;//from  w  ww  .ja va 2s.  c o m
            log.trace(
                    entry.getKey() + ": " + (entry.getValue() == null ? "null" : entry.getValue().toString()));
        }
    }
}

From source file:com.headissue.pigeon.util.LogUtils.java

public static void trace(Log log, String message, Object... args) {
    if (log.isTraceEnabled()) {
        if (args != null && args.length > 0) {
            message = String.format(message, args);
        }//from   w  w w .ja  v  a 2  s  .c o m
        log.trace(message);
    }
}

From source file:com.headissue.pigeon.util.LogUtils.java

public static void trace(Log log, Throwable t, String message, Object... args) {
    if (log.isTraceEnabled()) {
        if (args != null && args.length > 0) {
            message = String.format(message, args);
        }//  w  ww .j a  v a 2s .  c om
        log.trace(message, t);
    }
}

From source file:com.rsmart.rfabric.logging.FormattedLogger.java

/**
 * Wraps {@link Log#trace(String)}/*w w w  . j  av  a 2  s. co  m*/
 * 
 * @param pattern to format against
 * @param objs an array of objects used as parameters to the <code>pattern</code>
 */
public static final void trace(String pattern, Object... objs) {
    Log log = getLog();
    if (log.isTraceEnabled()) {
        log.trace(getMessage(pattern, objs));
    }
}

From source file:com.oncore.calorders.core.utils.Logger.java

/**
 * Writes a trace log entry if it is enabled
 *
 * @author OnCore Consulting LLC//  w  w w  .j a v a 2s .c o m
 *
 * @param log a handle to the log
 * @param message the text to log
 */
public static void trace(final Log log, final String message) {
    if (log != null && message != null) {
        if (log.isTraceEnabled()) {
            log.trace(message);
        }

    }
}

From source file:com.buffalokiwi.api.APILog.java

/**
 * Log a message with trace log level./*from   w w  w. j a v  a  2s . c om*/
 *
 * @param log Log to write to
 * @param message log this message
 */
public static void trace(final Log log, final Object... message) {
    if (log.isTraceEnabled())
        log.trace(concat(message));
}

From source file:com.buffalokiwi.api.APILog.java

/**
 * Log an error with trace log level./*ww  w  .j  a  v a  2 s . c  o  m*/
 *
 * @param log Log to write to
 * @param message log this message
 * @param t log this cause
 */
public static void trace(final Log log, final Throwable t, final Object... message) {
    if (log.isTraceEnabled())
        log.trace(concat(message), t);
}