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.microsoft.tfs.client.common.framework.command.TeamExplorerLogCommandStartedCallback.java

@Override
public void onCommandStarted(final ICommand command) {
    Check.notNull(command, "command"); //$NON-NLS-1$

    /*/*w  w w  .  j a v a2  s.  co m*/
     * Don't have a static Log for this class, because then the errors show
     * up as coming from this class, which is not correct. Instead, get the
     * logger for the class the errors originated from. Note that this is
     * not a particularly expensive operation - it looks up the classname in
     * a hashmap. This should be more than suitable for a command finished
     * error handler.
     */
    final Log log = LogFactory.getLog(CommandHelpers.unwrapCommand(command).getClass());

    final String logMessage = command.getLoggingDescription();

    if (logMessage != null) {
        log.info(logMessage);
    }
}

From source file:jatoo.log4j.Log4jUtilsTest.java

@Test
public void testManyLoggers() {

    Log4jUtils.init(WORKING_DIRECTORY);/*w ww. ja  v  a2s  .  com*/

    //
    // 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.CodeSeance.JSeance.CodeGenXML.Context.java

public void LogInfoMessage(Log log, String tagName, String message) {
    if (log.isInfoEnabled()) {
        log.info(String.format("%s<%s> - %s", logSpacing, tagName, message));
    }/*from w w w.  jav a 2s  .co m*/
}

From source file:com.android.tests.lib.LibUnitTest.java

@Test
public void commonsLogging() {
    Log log = LogFactory.getLog(getClass());
    log.info("I can use commons-logging!");
}

From source file:epgtools.loggerfactory.LoggerFactoryTest.java

/**
 * Test of getLOG method, of class LoggerFactory.
 *//*  ww w.j av  a 2  s  .  c o m*/
@Test
public void testGetLOG() {
    MAIN_LOG.info("getLOG");
    LoggerFactory instance = new LoggerFactory(this.getClass(), true);
    Log expResult = LogFactory.getLog(this.getClass());
    Log result = instance.getLOG();

    //?????????
    expResult.info("Message from expResult.");
    result.info("Message from result.");

    assertEquals(expResult, result);
}

From source file:io.netty.logging.CommonsLoggerTest.java

@Test
public void testInfo() {
    Log mock = createStrictMock(Log.class);

    mock.info("a");
    replay(mock);// w ww . jav a2 s . co m

    InternalLogger logger = new CommonsLogger(mock, "foo");
    logger.info("a");
    verify(mock);
}

From source file:fr.gouv.vitam.utils.logging.CommonsLoggerTest.java

@Test
public void testInfo() {
    final Log mock = createStrictMock(Log.class);

    mock.info("a");
    replay(mock);//www.  ja  v a2 s  .c o m

    final VitamLogger logger = new CommonsLogger(mock, "foo");
    logger.info("a");
    verify(mock);
}

From source file:com.cyberway.core.quartz.objects.example.PlugInExample.java

public void run() throws Exception {
    Log log = LogFactory.getLog(PlugInExample.class);

    // First we must get a reference to a scheduler
    SchedulerFactory sf = new StdSchedulerFactory();
    Scheduler sched = sf.getScheduler();

    log.info("------- Initialization Complete -----------");

    log.info("------- (Not Scheduling any Jobs - relying on XML definitions --");

    log.info("------- Starting Scheduler ----------------");

    // start the schedule 
    sched.start();//  w  ww  .  j ava  2  s.c  om

    log.info("------- Started Scheduler -----------------");

    log.info("------- Waiting five minutes... -----------");

    // wait five minutes to give our jobs a chance to run
    try {
        Thread.sleep(50L * 1000L);
    } catch (Exception e) {
    }

    // shut down the scheduler
    log.info("------- Shutting Down ---------------------");
    sched.shutdown(true);
    log.info("------- Shutdown Complete -----------------");

    SchedulerMetaData metaData = sched.getMetaData();
    log.info("Executed " + metaData.getNumberOfJobsExecuted() + " jobs.");
}

From source file:net.sourceforge.dita4publishers.tools.dxp.DitaDxpHelper.java

/**
 * @param dxpFile// w  ww.ja v  a2  s . c  om
 * @param outputDir
 * @param dxpOptions
 * @throws Exception 
 */
public static void unpackDxpPackage(File dxpFile, File outputDir, DitaDxpOptions dxpOptions, Log log)
        throws Exception {
    ZipFile zipFile = new ZipFile(dxpFile);
    ZipEntry rootMapEntry = getDxpPackageRootMap(zipFile, dxpOptions);
    // rootMapEntry will have a value if we get this far.

    /**
     * At this point could simply unpack the Zip file blindly or could build
     * the map BOS from the root map by processing the Zip file entries and
     * then only unpacking those that are actually used by the map. The latter
     * case would be appropriate for packages that include multiple maps, for 
     * example, when a set of peer root maps have been packaged together. 
     * 
     * For now, just blindly unpacking the whole zip.
     */

    if (dxpOptions.isUnzipAll()) {
        MultithreadedUnzippingController controller = new MultithreadedUnzippingController(dxpOptions);
        if (!dxpOptions.isQuiet())
            log.info("Unzipping entire DXP package \"" + dxpFile.getAbsolutePath() + "\" to output directory \""
                    + outputDir + "\"...");
        controller.unzip(dxpFile, outputDir, true);
        if (!dxpOptions.isQuiet())
            log.info("Unzip complete");
    } else {
        List<String> mapIds = dxpOptions.getRootMaps();
        List<ZipEntry> mapEntries = new ArrayList<ZipEntry>();
        if (mapIds.size() == 0) {
            mapEntries.add(rootMapEntry);
        } else {
            mapEntries = getMapEntries(zipFile, mapIds);
        }
        for (ZipEntry mapEntry : mapEntries) {
            extractMap(zipFile, mapEntry, outputDir, dxpOptions);
        }
    }

}

From source file:dk.netarkivet.common.utils.batch.GoodPostProcessingJob.java

@Override
public boolean postProcess(InputStream input, OutputStream output) {
    Log log = LogFactory.getLog(this.getClass());
    try {/*from   w w  w  . j  a va  2s  .c  o  m*/
        // sort the input stream.
        List<String> filenames = new ArrayList<String>();

        log.info("Reading all the filenames.");
        // read all the filenames.
        BufferedReader br = new BufferedReader(new InputStreamReader(input));
        String line;
        while ((line = br.readLine()) != null) {
            filenames.add(line);
        }

        log.info("Sorting the filenames");
        // sort and print to output.
        Collections.sort(filenames);
        for (String file : filenames) {
            output.write(file.getBytes());
            output.write("\n".getBytes());
        }

        return true;
    } catch (Exception e) {
        log.warn(e.getMessage());
        return false;
    }
}