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.sebuilder.interpreter.SeInterpreter.java

public static void main(String[] args) {
    if (args.length == 0) {
        System.out.println(/*from  w  w w.  j av a  2 s  . c  o m*/
                "Usage: [--driver=<drivername] [--driver.<configkey>=<configvalue>...] [--implicitlyWait=<ms>] [--pageLoadTimeout=<ms>] [--stepTypePackage=<package name>] <script path>...");
        System.exit(0);
    }

    Log log = LogFactory.getFactory().getInstance(SeInterpreter.class);

    WebDriverFactory wdf = DEFAULT_DRIVER_FACTORY;
    ScriptFactory sf = new ScriptFactory();
    StepTypeFactory stf = new StepTypeFactory();
    sf.setStepTypeFactory(stf);
    TestRunFactory trf = new TestRunFactory();
    sf.setTestRunFactory(trf);

    ArrayList<String> paths = new ArrayList<String>();
    HashMap<String, String> driverConfig = new HashMap<String, String>();
    for (String s : args) {
        if (s.startsWith("--")) {
            String[] kv = s.split("=", 2);
            if (kv.length < 2) {
                log.fatal("Driver configuration option \"" + s
                        + "\" is not of the form \"--driver=<name>\" or \"--driver.<key>=<value\".");
                System.exit(1);
            }
            if (s.startsWith("--implicitlyWait")) {
                trf.setImplicitlyWaitDriverTimeout(Integer.parseInt(kv[1]));
            } else if (s.startsWith("--pageLoadTimeout")) {
                trf.setPageLoadDriverTimeout(Integer.parseInt(kv[1]));
            } else if (s.startsWith("--stepTypePackage")) {
                stf.setPrimaryPackage(kv[1]);
            } else if (s.startsWith("--driver.")) {
                driverConfig.put(kv[0].substring("--driver.".length()), kv[1]);
            } else if (s.startsWith("--driver")) {
                try {
                    wdf = (WebDriverFactory) Class
                            .forName("com.sebuilder.interpreter.webdriverfactory." + kv[1]).newInstance();
                } catch (ClassNotFoundException e) {
                    log.fatal("Unknown WebDriverFactory: " + "com.sebuilder.interpreter.webdriverfactory."
                            + kv[1], e);
                } catch (InstantiationException e) {
                    log.fatal("Could not instantiate WebDriverFactory "
                            + "com.sebuilder.interpreter.webdriverfactory." + kv[1], e);
                } catch (IllegalAccessException e) {
                    log.fatal("Could not instantiate WebDriverFactory "
                            + "com.sebuilder.interpreter.webdriverfactory." + kv[1], e);
                }
            } else {
                paths.add(s);
            }
        } else {
            paths.add(s);
        }
    }

    if (paths.isEmpty()) {
        log.info("Configuration successful but no paths to scripts specified. Exiting.");
        System.exit(0);
    }

    HashMap<String, String> cfg = new HashMap<String, String>(driverConfig);

    for (String path : paths) {
        try {
            TestRun lastRun = null;
            for (Script script : sf.parse(new File(path))) {
                for (Map<String, String> data : script.dataRows) {
                    try {
                        lastRun = script.testRunFactory.createTestRun(script, log, wdf, driverConfig, data,
                                lastRun);
                        if (lastRun.finish()) {
                            log.info(script.name + " succeeded");
                        } else {
                            log.info(script.name + " failed");
                        }
                    } catch (Exception e) {
                        log.info(script.name + " failed", e);
                    }
                }
            }
        } catch (Exception e) {
            log.fatal("Run error.", e);
            System.exit(1);
        }
    }
}

From source file:com.microsoft.tfs.sdk.samples.console.LogConfigurationSample.java

private static void logAllLevels(final Log log, final String message) {
    log.trace(message);//  w ww. j ava  2s  . c o  m
    log.debug(message);
    log.info(message);
    log.warn(message);
    log.error(message);
    log.fatal(message);
}

From source file:net.servicefixture.util.InfoLogger.java

public static void log(Log log, String message) {
    if (!FixtureTemplateCreator.isGeneratingFixtureTemplate()) {
        log.info(message);
    }//from ww  w.j a  v a2 s.c  o  m
}

From source file:jp.ac.u.tokyo.m.log.LogUtil.java

/**
 * Output "[aPrefix]\"[aParams[0]]\" \"[aParams[1]]\"... [aSuffix]" format log. <br>
 * "[aPrefix]\"[aParams[0]]\" \"[aParams[1]]\"... [aSuffix]" ???? <br>
 *//*from  w w  w .ja v a 2 s .  c om*/
public static void infoMultiParam(Log aLog, String aPrefix, String aSuffix, List<? extends Object> aParams) {
    aLog.info(createMultiParamMessage(aPrefix, aSuffix, aParams));
}

From source file:com.mellanox.hadoop.mapred.UdaShuffleProviderPluginShared.java

static void close(Log LOG) {
    List<String> params = new ArrayList<String>();
    String msg = UdaCmd.formCmd(UdaCmd.EXIT_COMMAND, params);
    LOG.info("UDA: sending EXIT_COMMAND");
    UdaBridge.doCommand(msg);/*from   ww w.j  av a 2 s  .  co  m*/
}

From source file:com.chinamobile.bcbsp.graph.MetaDataOfGraph.java

/** Show the statistics of per bucket. */
public static void LogStatisticsPerBucket(Log LOG) {
    for (int i = 0; i < BCBSP_DISKGRAPH_HASHNUMBER; i++) {
        LOG.info("<Bucket - " + i + "> Vertices Is :" + VERTEX_NUM_PERBUCKET[i] + "_____ " + "Edges Is : "
                + EDGE_NUM_PERBUCKET[i]);
    }//from   w w  w .  ja  va 2s . c o m
    initializeMaxBucket();
    LOG.info("[The Max Size Bucket]  " + BCBSP_MAX_BUCKET_INDEX + " [Bucket Size] "
            + VERTEX_NUM_PERBUCKET[BCBSP_MAX_BUCKET_INDEX]);
}

From source file:com.rsmart.rfabric.logging.FormattedLogger.java

/**
 * Wraps {@link Log#info(String)}//  w  ww .j a va2  s  .  co m
 * 
 * @param pattern to format against
 * @param objs an array of objects used as parameters to the <code>pattern</code>
 */
public static final void info(String pattern, Object... objs) {
    Log log = getLog();
    if (log.isInfoEnabled()) {
        log.info(getMessage(pattern, objs));
    }
}

From source file:com.diversityarrays.util.ClassPathExtender.java

private static void info(Log logger, Object msg) {
    if (logger != null) {
        logger.info(msg);
    } else {/*  w  ww.  ja va2s . c  o m*/
        System.out.println(msg);
    }
}

From source file:com.oncore.calorders.core.utils.Logger.java

/**
 * Writes an info log entry if it is enabled
 *
 * @author OnCore Consulting LLC/*from   ww w.  j a v  a2s .c om*/
 *
 * @param log a handle to the log
 * @param message the text to log
 */
public static void info(final Log log, final String message) {
    if (log != null && message != null) {
        if (log.isInfoEnabled()) {
            log.info(message);
        }

    }
}

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

/**
 * Log a message with info log level./*from  w  w w.  ja va  2s. co  m*/
 *
 * @param log Log to write to
 * @param message log this message
 */
public static void info(final Log log, final Object... message) {
    if (log.isInfoEnabled())
        log.info(concat(message));
}