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

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

Introduction

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

Prototype

void fatal(Object message);

Source Link

Document

Logs a message with fatal log level.

Usage

From source file:hadoopInstaller.logging.CompositeLog.java

@Override
public void fatal(Object message) {
    for (Log log : this.logs) {
        log.fatal(message);
    }
}

From source file:jatoo.log4j.Log4jUtilsTest.java

@Test
public void testOneLogger() {

    Log4jUtils.init(WORKING_DIRECTORY);/*from  w  w  w . j  a va  2s .c o m*/

    Log logger = LogFactory.getLog(Log4jUtilsTest.class);

    logger.debug("debug");
    logger.info("info");
    logger.warn("warn");
    logger.error("error");
    logger.fatal("fatal");
}

From source file:jatoo.log4j.Log4jUtilsTest.java

@Test
public void testManyLoggers() {

    Log4jUtils.init(WORKING_DIRECTORY);// www  .jav a2 s . c o  m

    //
    // logger 1

    Log logger1 = LogFactory.getLog("logger1");

    logger1.debug("debug");
    logger1.info("info");
    logger1.warn("warn");
    logger1.error("error");
    logger1.fatal("fatal");

    //
    // logger 2

    Log logger2 = LogFactory.getLog("logger2");

    logger2.debug("debug");
    logger2.info("info");
    logger2.warn("warn");
    logger2.error("error");
    logger2.fatal("fatal");
}

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
 *//*from  w ww .  j  a va2 s  .c om*/
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  ww w .j a va  2  s. co  m
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.
 *
 * @param  log      the log where the messages will go
 * @param  basename the base name of the resource bundle
 * @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 w w  .ja v  a  2s  .c  o m
public static Msg fatal(Log log, BundleBaseName basename, String key, Object... varargs) {
    if (log.isFatalEnabled()) {
        Msg msg = Msg.createMsg(basename, 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  basename the base name of the resource bundle
 * @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
 *
 * @see    Msg#createMsg(com.sos.i18n.Msg.BundleBaseName, Locale, String, Object[])
 *///w  ww  .  j a v a  2s  .com
public static Msg fatal(Log log, BundleBaseName basename, Locale locale, String key, Object... varargs) {
    if (log.isFatalEnabled()) {
        Msg msg = Msg.createMsg(basename, locale, key, varargs);
        log.fatal((Logger.getDumpLogKeys()) ? ('{' + key + '}' + msg) : msg);
        return msg;
    }

    return null;
}

From source file:com.amazon.carbonado.repo.tupl.LogEventListener.java

@Override
public void notify(EventType type, String message, Object... args) {
    int intLevel = type.level.intValue();

    Log log = mLog;
    if (log != null) {
        if (intLevel <= Level.INFO.intValue()) {
            if (type.category == EventType.Category.CHECKPOINT) {
                if (log.isDebugEnabled()) {
                    log.debug(format(type, message, args));
                }/* ww w  . j a va  2  s  .c om*/
            } else if (log.isInfoEnabled()) {
                log.info(format(type, message, args));
            }
        } else if (intLevel <= Level.WARNING.intValue()) {
            if (log.isWarnEnabled()) {
                log.warn(format(type, message, args));
            }
        } else if (intLevel <= Level.SEVERE.intValue()) {
            if (log.isFatalEnabled()) {
                log.fatal(format(type, message, args));
            }
        }
    }

    if (intLevel > Level.WARNING.intValue() && mPanicHandler != null) {
        mPanicHandler.onPanic(mDatabase, type, message, args);
    }
}

From source file:com.siblinks.ws.common.BaseException.java

public void log(final Log log) {
    if (errorLevel.equals(ErrorLevel.INFO) && log.isDebugEnabled()) {
        log.debug("Info Message: ID - " + uniqueID + " User Message: " + userMessageKey);
        log.debug(StackTracer.getStackTrace(throwable));
    } else if (errorLevel.equals(ErrorLevel.WARNING) && log.isWarnEnabled()) {
        log.warn("Warn Message: ID - " + uniqueID + " User Message: " + userMessageKey);
        log.warn(StackTracer.getStackTrace(throwable));
    } else if (errorLevel.equals(ErrorLevel.ERROR) && log.isErrorEnabled()) {
        log.error("Error Message: ID - " + uniqueID + " User Message: " + userMessageKey);
        log.error(StackTracer.getStackTrace(throwable));
    } else if (errorLevel.equals(ErrorLevel.FATAL) && log.isFatalEnabled()) {
        log.fatal("Fatal Message: ID - " + uniqueID + " User Message: " + userMessageKey);
        log.fatal(StackTracer.getStackTrace(throwable));
    }//from w w w. j a  v a2 s.  c  om
    logged = true;
}

From source file:net.fenyo.mail4hotspot.service.AdvancedServicesImpl.java

@Override
public void testLog() {
    final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(getClass());

    log.trace("testlog: TRACE");
    log.fatal("testlog: FATAL");
    log.error("testlog: ERROR");
    log.info("testlog: INFO");
    log.debug("testlog: DEBUG");
    log.warn("testlog: WARN");
}