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:com.runwaysdk.logging.RunwayLogUtil.java

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

From source file:edu.du.penrose.systems.fedoraApp.util.FedoraAppUtil.java

/**
 * Note this will give back a pid even if the context is NOT valid! This uses a FedoraAdministrator with credentials pulled from the
 * batchIngest.propertes file./*from ww w.  j ava 2  s. c  o m*/
 * 
 * See runBatch() notes.
        
 * @param fedoraContext
 * @param numberOfPids
 * @return array of reserved pids
 * @throws FatalException
 */
public static String[] getPIDs(String fedoraContext, NonNegativeInteger numberOfPids) throws FatalException {

    if (numberOfPids.intValue() < 1) {
        throw new FatalException("Invalid number of pids reqeuested:" + numberOfPids);
    }

    String[] pids = null;
    try {
        pids = getAdministratorUsingProgramProperiesFileCredentials().getAPIM().getNextPID(numberOfPids,
                fedoraContext);

        if (pids.length != numberOfPids.intValue()) {
            throw new Exception("Asked Fedora for " + numberOfPids + " pids but got " + pids.length + " back.");
        }
    } catch (Exception e) {
        String errorMsg = "Unable to get PID:" + e.getLocalizedMessage();
        Log logger = LogFactory
                .getLog("edu.du.penrose.systems.fedoraApp.batchIngest.bus.FedoraAppBatchIngestController");
        logger.fatal(errorMsg);
        throw new FatalException(errorMsg);
    }

    return pids;
}

From source file:edu.du.penrose.systems.fedoraApp.util.FedoraAppUtil.java

/**
 * Note this will give back a pid even if the context is NOT valid!
 * //from   w w  w .j av a2 s . c o  m
 * @param host
 * @param port
 * @param userName
 * @param password
 * @param fedoraContext
 * @param numberOfPids
 * @return
 * @throws FatalException
 */
public static String[] getPIDs(Administrator admin, String fedoraContext, NonNegativeInteger numberOfPids)
        throws FatalException {

    if (numberOfPids.intValue() < 1) {
        throw new FatalException("Invalid number of pids reqeuested:" + numberOfPids);
    }

    String[] pids = null;
    try {
        pids = admin.getAPIM().getNextPID(numberOfPids, fedoraContext);

        if (pids.length != numberOfPids.intValue()) {
            throw new Exception("Asked Fedora for " + numberOfPids + " pids but got " + pids.length + " back.");
        }
    } catch (Exception e) {
        String errorMsg = "Unable to get PID:" + e.getLocalizedMessage();
        Log logger = LogFactory
                .getLog("edu.du.penrose.systems.fedoraApp.batchIngest.bus.FedoraAppBatchIngestController");
        logger.fatal(errorMsg);
        throw new FatalException(errorMsg);
    }

    return pids;
}

From source file:edu.du.penrose.systems.fedoraApp.util.FedoraAppUtil.java

/**
 * Note this will give back a pid even if the context is NOT valid!
 * //ww  w  .  j  av  a 2s. c  o m
 * @param host
 * @param port
 * @param userName
 * @param password
 * @param fedoraContext
 * @param numberOfPids
 * @return
 * @throws FatalException
 */
public static String[] getPIDs(String host, int port, String userName, String password, String fedoraContext,
        NonNegativeInteger numberOfPids) throws FatalException {

    if (numberOfPids.intValue() < 1) {
        throw new FatalException("Invalid number of pids reqeuested:" + numberOfPids);
    }

    String[] pids = null;
    try {

        pids = getAdministrator(host, port, userName, password).getAPIM().getNextPID(numberOfPids,
                fedoraContext);

        if (pids.length != numberOfPids.intValue()) {
            throw new Exception("Asked Fedora for " + numberOfPids + " pids but got " + pids.length + " back.");
        }
    } catch (Exception e) {
        String errorMsg = "Unable to get PID:" + e.getLocalizedMessage();
        Log logger = LogFactory
                .getLog("edu.du.penrose.systems.fedoraApp.batchIngest.bus.FedoraAppBatchIngestController");
        logger.fatal(errorMsg);
        throw new FatalException(errorMsg);
    }

    return pids;
}

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

public ChainedRuntimeException(String message, Log logger) {
    super(message);
    logger.fatal(message);
}

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

@Test
public void testLogFatalMessage() {
    String msg = "testLogFatalMessage";
    Log logger = LogFactory.getLog(getClass());
    logger.fatal(msg);
    assertLoggingOperation(Log.class, "FATAL", msg, null);
}

From source file:com.winvector.logistic.demo.MapReduceScore.java

@Override
public int run(final String[] args) throws Exception {
    if (args.length != 3) {
        final Log log = LogFactory.getLog(MapReduceScore.class);
        log.info(Licenses.licenses);/*from   w  w w . j av  a2s. co  m*/
        log.fatal("use: MapReduceScore model.ser testFile resultDir");
        return -1;
    }
    final String modelFileName = args[0];
    final String testFileName = args[1];
    final String resultFileName = args[2];
    run(modelFileName, testFileName, resultFileName);
    return 0;
}

From source file:com.winvector.logistic.demo.MapReduceLogisticTrain.java

@Override
public int run(final String[] args) throws Exception {
    if (args.length != 3) {
        final Log log = LogFactory.getLog(MapReduceLogisticTrain.class);
        log.info(Licenses.licenses);/*w ww .  j  a  va  2 s  .com*/
        log.fatal("use: MapReduceLogisticTrain trainFile formula resultFile");
        return -1;
    }
    final String trainFileName = args[0]; // file with input data in name=value pairs separated by tabs
    final String formulaStr = args[1]; // name of variable we expect to predict
    final String resultFileName = args[2];
    run(trainFileName, formulaStr, null, resultFileName, 5);
    return 0;
}

From source file:com.hphoto.util.ThreadPool.java

/**
 * Turn off the pool.  Every thread, when finished with
 * its current work, will realize that the pool is no
 * longer running, and will exit./*w  w  w .  jav a 2 s  .com*/
 */
public void shutdown() {
    running = false;
    Log l = LogFactory.getLog(ThreadPool.class.getName());
    l.fatal("ThreadPool shutting down.");
}

From source file:com.hphoto.util.ThreadPool.java

/**
 * Creates a pool of numThreads size./*from w w w.j  a  v a  2 s  .  c  o  m*/
 * These threads sit around waiting for jobs to
 * be posted to the list.
 */
public ThreadPool(int numThreads) {
    this.numThreads = numThreads;
    jobs = new Vector(37);
    running = true;

    for (int i = 0; i < numThreads; i++) {
        TaskThread t = new TaskThread();
        t.start();
    }
    Log l = LogFactory.getLog(ThreadPool.class.getName());
    l.fatal("ThreadPool created with " + numThreads + " threads.");
}