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

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

Introduction

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

Prototype

void info(Object message);

Source Link

Document

Logs a message with info log level.

Usage

From source file:com.brienwheeler.lib.monitor.telemetry.impl.TelemetryInfoJsonLogger.java

@Override
protected void onProcess(TelemetryInfo telemetryInfo) {
    Object jsonString = telemetryInfo.getProcessedVersion(TelemetryInfoJsonSerializer.VERSION_NAME);
    if (jsonString == null) {
        serializer.process(telemetryInfo);
        jsonString = telemetryInfo.getProcessedVersion(TelemetryInfoJsonSerializer.VERSION_NAME);
    }//from w  ww  . ja v a  2 s. c o m

    if (jsonString == null) {
        // serializer should have already logged an exception
        return;
    }

    Log logToUse = telemetryInfo.getLog();
    if (logToUse == null)
        logToUse = log;

    logToUse.info(jsonString);
}

From source file:het.springapp.model.User.java

public User(String[] values) {
    Log log = LogFactory.getLog(User.class);
    setUserId(values[0]);/*from   w w w. j av a 2 s . c  o m*/
    setPassword(values[1]);
    log.info("converting json object to user for userId " + values[0]);
}

From source file:com.acciente.induction.init.ClassLoaderInitializer.java

public static ClassLoader getClassLoader(Config.JavaClassPath oJavaClassPathConfig,
        ClassLoader oParentClassLoader) throws ClassNotFoundException {
    Log oLog;

    oLog = LogFactory.getLog(ClassLoaderInitializer.class);

    if (oJavaClassPathConfig.getDirList().size() == 0) {
        return oParentClassLoader;
    } else {//from   ww w  . ja va  2s  .c o m
        ReloadingClassLoader oClassLoader = new ReloadingClassLoader(oParentClassLoader);

        // we will ignore any dependencies for classes in any of the following packages
        oClassLoader.addIgnoredClassNamePrefix("java.");
        oClassLoader.addIgnoredClassNamePrefix("javax.");
        oClassLoader.addIgnoredClassNamePrefix("com.acciente.");

        // if there is a classpath defined setup a reloading classloader to handle the specified directories
        for (int i = 0; i < oJavaClassPathConfig.getDirList().size(); i++) {
            if (oJavaClassPathConfig.getDirList().get(i) instanceof Config.JavaClassPath.CompiledDir) {
                Config.JavaClassPath.CompiledDir oCompiledDir = (Config.JavaClassPath.CompiledDir) oJavaClassPathConfig
                        .getDirList().get(i);

                oLog.info(
                        "configuring reloading classloader for compiled classes in: " + oCompiledDir.getDir());

                // set up a compiled class definition loader
                JavaCompiledClassDefLoader oJavaCompiledClassDefLoader = new JavaCompiledClassDefLoader();
                oJavaCompiledClassDefLoader.setCompiledDirectory(oCompiledDir.getDir());
                oJavaCompiledClassDefLoader.setPackageNamePrefix(oCompiledDir.getPackageNamePrefix());

                // add the class def loader to the search list
                oClassLoader.addClassDefLoader(oJavaCompiledClassDefLoader);
            }
        }

        return oClassLoader;
    }
}

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

public double run(final String trainFileName, final String formulaStr, final String weightKey,
        final String resultFileName, final int maxNewtonRounds) throws Exception {
    final Log log = LogFactory.getLog(MapReduceLogisticTrain.class);
    log.info("start");
    final Formula formula = new Formula(formulaStr); // force an early parse error if wrong
    final Random rand = new Random();
    final String tmpPrefix = "TMPLR_" + rand.nextLong();
    final Configuration mrConfig = getConf();
    final Path trainFile = new Path(trainFileName);
    final Path resultFile = new Path(resultFileName);
    final String headerLine = WritableUtils.readFirstLine(mrConfig, trainFile);
    final Pattern sepPattern = Pattern.compile("\t");
    final LineBurster burster = new HBurster(sepPattern, headerLine, false);
    mrConfig.set(MapRedScan.BURSTERSERFIELD, SerialUtils.serializableToString(burster));
    final WritableVariableList lConfig = MapRedScan.initialScan(tmpPrefix, mrConfig, trainFile, formulaStr);
    log.info("formula:\t" + formulaStr + "\n" + lConfig.formatState());
    final VariableEncodings defs = new VariableEncodings(lConfig, true, weightKey);
    //final WritableSigmoidLossBinomial underlying = new WritableSigmoidLossBinomial(defs.dim());
    final SigmoidLossMultinomial underlying = new SigmoidLossMultinomial(defs.dim(), defs.noutcomes());
    final MapRedFn f = new MapRedFn(underlying, lConfig, defs.useIntercept(), tmpPrefix, mrConfig, trainFile);
    final ArrayList<VectorFn> fns = new ArrayList<VectorFn>();
    fns.add(f);/*from   ww  w .j a  va  2  s.c o  m*/
    fns.add(new NormPenalty(f.dim(), 1.0e-5, defs.adaptions));
    final VectorFn sl = new SumFn(fns);
    final VectorOptimizer nwt = new Newton();
    final VEval opt = nwt.maximize(sl, null, maxNewtonRounds);
    log.info("done training");
    log.info("soln vector:\n" + LinUtil.toString(opt.x));
    log.info("soln details:\n" + defs.formatSoln(opt.x));
    {
        final Model model = new Model();
        model.config = defs;
        model.coefs = opt.x;
        model.origFormula = formula;
        log.info("writing " + resultFile);
        final FSDataOutputStream fdo = resultFile.getFileSystem(mrConfig).create(resultFile, true);
        final ObjectOutputStream oos = new ObjectOutputStream(fdo);
        oos.writeObject(model);
        oos.close();
    }
    final MapRedAccuracy sc = new MapRedAccuracy(underlying, lConfig, defs.useIntercept(), tmpPrefix, mrConfig,
            trainFile);
    final long[] trainAccuracy = sc.score(opt.x);
    final double accuracy = trainAccuracy[0] / (double) trainAccuracy[1];
    log.info("train accuracy: " + trainAccuracy[0] + "/" + trainAccuracy[1] + "\t" + accuracy);
    return accuracy;
}

From source file:dk.netarkivet.common.utils.CleanupHook.java

/**
 * Called by the JVM to clean up the object before exiting.
 * The method calls the cleanup() method 
 * Note: System.out.println is added in this method
 * because logging may or may not be active at this time.
 *//*from w w w. j  a v  a  2  s.  c o m*/
public void run() {
    Log log = null;
    try {
        log = LogFactory.getLog(appName);
        log.info("Cleaning up " + appName);
    } catch (Throwable e) {
        //Ignore
    }
    try {
        app.cleanup();
    } catch (Throwable e) {
        System.out.println("Error while cleaning up " + appName);
        e.printStackTrace();
    }
    try {
        System.out.println("Cleaned up " + appName);
        log.info("Cleaned up " + appName);
    } catch (Throwable e) {
        System.out.println("Cleaned up " + appName + " but failed to log afterwards");
        e.printStackTrace();
    }
}

From source file:dk.netarkivet.common.utils.ShutdownHook.java

/**
 * Called by the JVM to clean up the object before exiting.
 * The method calls the cleanup() method 
 * Note: System.out.println is added in this method
 * because logging may or may not be active at this time.
 *//*  w  ww  .ja va2s  .  c o  m*/
public void run() {
    Log log = null;
    try {
        log = LogFactory.getLog(appName);
        log.info("Shutting down " + appName);
    } catch (Throwable e) {
        //Ignore
    }
    try {
        app.shutdown();
    } catch (Throwable e) {
        System.out.println("Error while  shutting down " + appName);
        e.printStackTrace();
    }
    try {
        System.out.println("Shutting down " + appName);
        log.info("Shutting down " + appName);
    } catch (Throwable e) {
        System.out.println("Shutting down " + appName + " but failed to log afterwards");
        e.printStackTrace();
    }
}

From source file:cl.borrego.foundation.util.Message.java

protected void dumpFormattedMessage(Log log, LevelEnum level, String key, Object... arguments) {
    switch (level) {
    case INFO:/*from   ww  w  .  j  av a  2 s . c om*/
        log.info(getFormattedMessage(key, arguments));
        break;
    case DEBUG:
        log.debug(getFormattedMessage(key, arguments));
        break;
    default:
    }
}

From source file:com.chnoumis.commons.log.LogAspect.java

@Around("execution(* com.chnoumis..*.*(..))")
public Object doTrace(ProceedingJoinPoint pjp) throws Throwable {
    Log log = LogFactory.getLog(pjp.getSignature().getDeclaringType());
    Object retVal = null;/* w  w w .ja v  a  2 s .  c  o  m*/
    //if (log.isDebugEnabled()) {
    log.info("Starting method " + pjp.getSignature().toLongString());
    retVal = pjp.proceed();
    log.info("Ending method " + pjp.getSignature().toLongString());
    // log.info("Method returned " + retVal);
    //}
    return retVal;
}

From source file:fr.cls.atoll.motu.web.servlet.listener.Log4JConfigListener.java

@Override
public void contextInitialized(ServletContextEvent sce) {
    final String paramValue = sce.getServletContext().getInitParameter(CONFIG_LOCATION_PARAM);

    final String configFilename = (paramValue == null ? DEFAULT_CONFIG_FILE_NAME : paramValue);

    URL url = null;/*  w w w  . j  a va  2s.co m*/
    try {
        if (configFilename.indexOf("file:") == 0) {
            url = new URL(configFilename);
        } else {
            url = ConfigLoader.getInstance().get(configFilename);
        }
        if (url == null) {
            url = new URL(configFilename);
        }
        if (url != null) {
            DOMConfigurator.configure(url);
        } else {
            System.err.println(configFilename + " configuration failure.");
            return;
        }
        Log log = LogFactory.getLog(Log4JConfigListener.class);
        log.info(configFilename + " configuration success.");
    } catch (FactoryConfigurationError ex) {
        System.err.println(configFilename + " configuration failure.");
    } catch (IOException e) {
        System.err.println("File \"" + configFilename + "\" not found in file system.");
    }

}

From source file:edu.cornell.med.icb.goby.util.WarningCounter.java

public void info(org.apache.commons.logging.Log log, String format, Object... option) {
    if (warnAgain()) {
        log.info(String.format(format, option));
    }/*from  w ww .  j  a va  2s  .  c  om*/
}