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, Throwable t);

Source Link

Document

Logs an error with fatal log level.

Usage

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

/**
 * Log an error with fatal log level.//  w ww  .  j  ava  2  s. 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:net.gleamynode.netty2.SessionLog.java

public static void fatal(Log log, Session session, Object obj, Throwable cause) {
    log.fatal(getMessage(session, obj), cause);
}

From source file:com.datos.vfs.VfsLog.java

/**
 * fatal./*  www.  java 2s.co m*/
 * @param vfslog The base component Logger to use.
 * @param commonslog The class specific Logger
 * @param message The message to log.
 * @param t The exception, if any.
 */
public static void fatal(final Log vfslog, final Log commonslog, final String message, final Throwable t) {
    if (vfslog != null) {
        vfslog.fatal(message, t);
    } else if (commonslog != null) {
        commonslog.fatal(message, t);
    }
}

From source file:com.runwaysdk.logging.RunwayLogUtil.java

public static void logToLevel(Log log, LogLevel level, String msg, Throwable t) {
    if (level == LogLevel.TRACE) {
        log.trace(msg, t);//  ww w . j av a  2s  .  co  m
    } else if (level == LogLevel.DEBUG) {
        log.debug(msg, t);
    } else if (level == LogLevel.INFO) {
        log.info(msg, t);
    } else if (level == LogLevel.WARN) {
        log.warn(msg, t);
    } else if (level == LogLevel.ERROR) {
        log.error(msg, t);
    } else if (level == LogLevel.FATAL) {
        log.fatal(msg, t);
    } else {
        log.fatal(
                "RunwayLogUtil.logToLevel was called, but an invalid level was specified. Here is the message we were passed: '"
                        + msg + "'");
    }
}

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

public ChainedRuntimeException(String message, Throwable cause, Log logger) {
    super(message);
    this.cause = cause;
    logger.fatal(message, cause);
}

From source file:com.springsource.insight.plugin.logging.CommonsLoggingOperationCollectionAspectTest.java

@Test
public void testLogFatalMessageWithException() {
    String msg = "testLogFatalMessageWithException";
    Log logger = LogFactory.getLog(getClass());
    Throwable t = new IllegalArgumentException(msg);
    logger.fatal(msg, t);
    assertLoggingOperation(Log.class, "FATAL", msg, t);
}

From source file:hadoopInstaller.logging.CompositeLog.java

@Override
public void fatal(Object message, Throwable t) {
    for (Log log : this.logs) {
        log.fatal(message, t);
    }//w  w w. ja  va  2 s .co  m
}

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

/**
 * Logs the message, along with the given <code>throwable</code>, at the fatal level. If
 * {@link Logger#getDumpStackTraces() stack traces are not to be dumped}, it doesn't matter. FATAL log level
 * messages should be very rare and normally indicate a very bad condition. In this case, we should always dump
 * the stack trace no matter how we are configured.
 *
 * @param log       where to log the message
 * @param key       the resource key that is associated with the message
 * @param msg       the message to log/*www.jav a 2  s. c o  m*/
 * @param throwable the throwable associated with the message
 */
private static void logFatalWithThrowable(Log log, String key, Msg msg, Throwable throwable) {
    log.fatal(((Logger.getDumpLogKeys()) ? ('{' + key + '}' + msg) : msg), throwable);
}

From source file:net.sf.nmedit.nomad.core.NomadLoader.java

public Nomad createNomad(final NomadPlugin plugin) {
    NomadLoader.plugin = plugin;//from   ww w  .  ja  va 2  s  .co m

    // first get the boot progress callbeck
    final SplashHandler progress = Boot.getSplashHandler();
    // initializing ...
    progress.setText("Initializing Nomad...");
    progress.setProgress(0.1f);
    // now we read all property files
    // 1. nomad.properties
    final Properties nProperties = new Properties();
    getProperties(nProperties, Nomad.getCorePropertiesFile());

    RootSystemProperties sproperties = new RootSystemProperties(nProperties);
    SystemPropertyFactory.sharedInstance().setFactory(new NomadPropertyFactory(sproperties));

    // 1.2 init locale
    initLocale();
    // 1.4 menu layout configuration
    InputStream mlIn = null;
    try {
        ClassLoader loader = getClass().getClassLoader();
        mlIn = loader.getResourceAsStream("./MenuLayout.xml");

        menuLayout = MenuLayout.getLayout(new BufferedInputStream(mlIn));
    } catch (Exception e) {
        Log log = LogFactory.getLog(getClass());
        if (log.isFatalEnabled()) {
            log.fatal("could not read MenuLayout", e);
        }
        throw new RuntimeException(e);
    } finally {
        try {
            if (mlIn != null)
                mlIn.close();
        } catch (IOException e) {
            Log log = LogFactory.getLog(NomadLoader.class);
            if (log.isWarnEnabled()) {
                log.warn("closing menu layout", e);
            }
        }
    }
    // increase progress
    progress.setProgress(0.2f);
    // 1.5 initialize look and feel (important: before creating any swing components)

    String lafClassName = plugin.getDescriptor().getAttribute("javax.swing.LookAndFeel").getValue();
    String themeClassName = plugin.getDescriptor().getAttribute("javax.swing.plaf.metal.MetalTheme").getValue();
    String defaultLafOnPlatform = plugin.getDescriptor().getAttribute("nomad.plaf.usePlatformDefault")
            .getValue();

    initLookAndFeel(lafClassName, themeClassName, defaultLafOnPlatform);
    // 1.6 initialize main window's menu
    progress.setProgress(0.3f);

    /*     NomadActionControl nomadActions = new NomadActionControl( Nomad.sharedInstance() );
          nomadActions.installActions(menuBuilder);
      */
    progress.setProgress(0.5f);
    progress.setText("Initializing main window...");

    activatePlugins();

    progress.setText("Initializing services...");

    JPFServiceInstallerTool.activateAllServices(plugin);
    progress.setText("Starting Nomad...");

    // SwingUtilities.invokeLater(run);

    Nomad nomad = new Nomad(plugin, menuLayout);
    return nomad;
}

From source file:com.ayovel.nian.exception.XLog.java

private void log(Level level, int loggerMask, String msgTemplate, Object... params) {
    loggerMask |= STD;/*from  w w w .java2s.c om*/
    if (isEnabled(level, loggerMask)) {
        String prefix = getMsgPrefix() != null ? getMsgPrefix() : Info.get().getPrefix();
        prefix = (prefix != null && prefix.length() > 0) ? prefix + " " : "";

        String msg = prefix + format(msgTemplate, params);
        Throwable throwable = getCause(params);

        for (int i = 0; i < LOGGER_MASKS.length; i++) {
            if (isEnabled(level, loggerMask & LOGGER_MASKS[i])) {
                Log log = loggers[i];
                switch (level) {
                case FATAL:
                    log.fatal(msg, throwable);
                    break;
                case ERROR:
                    log.error(msg, throwable);
                    break;
                case INFO:
                    log.info(msg, throwable);
                    break;
                case WARN:
                    log.warn(msg, throwable);
                    break;
                case DEBUG:
                    log.debug(msg, throwable);
                    break;
                case TRACE:
                    log.trace(msg, throwable);
                    break;
                }
            }
        }
    }
}