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

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

Introduction

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

Prototype

boolean isFatalEnabled();

Source Link

Document

Is fatal 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 va2 s .  com
    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:com.rsmart.rfabric.logging.FormattedLogger.java

/**
 * Wraps {@link Log#fatal(String)}//from  w w w  . j ava  2 s. c  om
 * 
 * @param pattern to format against
 * @param objs an array of objects used as parameters to the <code>pattern</code>
 */
public static final void fatal(String pattern, Object... objs) {
    Log log = getLog();
    if (log.isFatalEnabled()) {
        log.fatal(getMessage(pattern, objs));
    }
}

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

/**
 * Log a message with fatal log level.//from   w w w.  j  a  v  a2s  . com
 * @param log Log to write to
 * @param message log this message
 */
public static void fatal(final Log log, final Object... message) {
    if (log.isFatalEnabled())
        log.fatal(concat(message));
}

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

/**
 * Log an error with fatal log level.//from  w  w w.j av a2s.  c  o  m
 *
 * @param log Log to write to
 * @param message log this message
 * @param t log this cause
 */
public static void fatal(final Log log, final Throwable t, final Object... message) {
    if (log.isFatalEnabled())
        log.fatal(concat(message), t);
}

From source file:edu.cornell.mannlib.vitro.webapp.utils.log.LogUtils.java

private static boolean isLevelEnabled(Log log, String level) {
    if ("fatal".equalsIgnoreCase(level)) {
        return log.isFatalEnabled();
    } else if ("error".equalsIgnoreCase(level)) {
        return log.isErrorEnabled();
    } else if ("warn".equalsIgnoreCase(level)) {
        return log.isWarnEnabled();
    } else if ("info".equalsIgnoreCase(level)) {
        return log.isInfoEnabled();
    } else if ("debug".equalsIgnoreCase(level)) {
        return log.isDebugEnabled();
    } else {/* w  w w .  j  a  v  a2 s. co m*/
        return log.isTraceEnabled();
    }
}

From source file:com.stimulus.archiva.exception.ChainedException.java

public static Level getLoggingLevel(Log logger) {
    if (logger.isDebugEnabled())
        return Level.DEBUG;
    else if (logger.isInfoEnabled())
        return Level.INFO;
    else if (logger.isWarnEnabled())
        return Level.WARN;
    else if (logger.isErrorEnabled())
        return Level.ERROR;
    else if (logger.isFatalEnabled())
        return Level.FATAL;

    return Level.DEBUG;
}

From source file:hadoopInstaller.logging.CompositeLog.java

@Override
public boolean isFatalEnabled() {
    boolean enabled = true;
    for (Log log : this.logs) {
        enabled = enabled && log.isFatalEnabled();
    }/*from  w  w w . j  av a 2  s  .c o m*/
    return enabled;
}

From source file:com.sos.i18n.logging.commons.CommonsLogMsg.java

/**
 * Logs the given message to the log at the fatal level. If the log level is not enabled, this method does
 * nothing and returns <code>null</code>. If a message was logged, its {@link Msg} will be returned.
 *
 * @param  log     the log where the messages will go
 * @param  key     the resource bundle key name
 * @param  varargs arguments to help fill in the resource bundle message
 *
 * @return if the message was logged, a non-<code>null</code> Msg object is returned
 *///ww w. j  a  v a  2  s  .c o m
public static Msg fatal(Log log, String key, Object... varargs) {
    if (log.isFatalEnabled()) {
        Msg msg = Msg.createMsg(key, varargs);
        log.fatal((Logger.getDumpLogKeys()) ? ('{' + key + '}' + msg) : msg);
        return msg;
    }

    return null;
}

From source file:com.sos.i18n.logging.commons.CommonsLogMsg.java

/**
 * Logs the given message to the log at the fatal level. If the log level is not enabled, this method does
 * nothing and returns <code>null</code>. If a message was logged, its {@link Msg} will be returned.
 *
 * @param  log     the log where the messages will go
 * @param  locale  the locale to determine what bundle to use
 * @param  key     the resource bundle key name
 * @param  varargs arguments to help fill in the resource bundle message
 *
 * @return if the message was logged, a non-<code>null</code> Msg object is returned
 *//*from  w w  w.  j a v  a2  s.c  om*/
public static Msg fatal(Log log, Locale locale, String key, Object... varargs) {
    if (log.isFatalEnabled()) {
        Msg msg = Msg.createMsg(locale, key, varargs);
        log.fatal((Logger.getDumpLogKeys()) ? ('{' + key + '}' + msg) : msg);
        return msg;
    }

    return null;
}

From source file:com.sos.i18n.logging.commons.CommonsLogMsg.java

/**
 * Logs the given message to the log at the fatal level. If the log level is not enabled, this method does
 * nothing and returns <code>null</code>. If a message was logged, its {@link Msg} will be returned.
 *
 * <p>The given Throwable will be passed to the logger so its stack can be dumped when appropriate.</p>
 *
 * @param  log       the log where the messages will go
 * @param  throwable the throwable associated with the log message
 * @param  key       the resource bundle key name
 * @param  varargs   arguments to help fill in the resource bundle message
 *
 * @return if the message was logged, a non-<code>null</code> Msg object is returned
 *//*w  ww  .  j ava2s.  c o  m*/
public static Msg fatal(Log log, Throwable throwable, String key, Object... varargs) {
    if (log.isFatalEnabled()) {
        Msg msg = Msg.createMsg(key, varargs);
        logFatalWithThrowable(log, key, msg, throwable);
        return msg;
    }

    return null;
}