Example usage for org.apache.commons.logging LogFactory getLog

List of usage examples for org.apache.commons.logging LogFactory getLog

Introduction

In this page you can find the example usage for org.apache.commons.logging LogFactory getLog.

Prototype

public static Log getLog(String name) 

Source Link

Document

Convenience method to return a named logger.

Usage

From source file:com.buaa.cfs.utils.VersionInfo.java

protected VersionInfo(String component) {
    info = new Properties();
    String versionInfoFile = component + "-version-info.properties";
    InputStream is = null;/* w w  w . j  a v a  2s  .  c  om*/
    try {
        is = Thread.currentThread().getContextClassLoader().getResourceAsStream(versionInfoFile);
        if (is == null) {
            throw new IOException("Resource not found");
        }
        info.load(is);
    } catch (IOException ex) {
        LogFactory.getLog(getClass()).warn("Could not read '" + versionInfoFile + "', " + ex.toString(), ex);
    } finally {
        IOUtils.closeStream(is);
    }
}

From source file:com.boylesoftware.web.RouterRequestLifecycle.java

/**
 * Disassociate router request from the container request and recycle it.
 *
 * @param routerReq The router request./*from w  w w. j a v a  2s  .  c om*/
 */
static void recycle(final RouterRequest routerReq) {

    routerReq.removeAttribute(ROUTER_REQ_ATTNAME);
    try {
        routerReq.recycle();
    } catch (final Exception e) {
        LogFactory.getLog(RouterRequestLifecycle.class).fatal("error recycling router request", e);
        // TODO: do we have to be that brutal?
        System.exit(1);
    }
}

From source file:com.krawler.esp.utils.mime.MimeTypesReader.java

MimeTypesReader(Log logger) {
    if (logger == null) {
        this.logger = LogFactory.getLog(this.getClass());
    } else {//from w w  w  . j a  va 2  s.c  o m
        this.logger = logger;
    }
}

From source file:cz.filmtit.userspace.USLogger.java

private USLogger() {
    jLogger = LogFactory.getLog("Userspace/Gui");
    logConsoleLevel = LevelLogEnum.DebugNotice;
    logDbLevel = LevelLogEnum.DebugNotice;
}

From source file:com.alfaariss.oa.authentication.password.AbstractResourceHandler.java

/**
 * Constructor
 */
public AbstractResourceHandler() {
    _logger = LogFactory.getLog(this.getClass());
}

From source file:com.learning.mocks.account.DefaultAccountManager2.java

/**
 * Constructor with no parameters./*from  www  .j av a2 s. c o  m*/
 */
public DefaultAccountManager2() {
    this(LogFactory.getLog(DefaultAccountManager2.class), new DefaultConfiguration("technical"));
}

From source file:com.jpeterson.littles3.dao.je.JeBucketDao.java

public JeBucketDao() {
    super();
    logger = LogFactory.getLog(this.getClass());
    logger.debug("JeBucketDao created");
}

From source file:com.moss.posixfifosockets.PosixFifoSocket.java

public static PosixFifoSocket newClientConnection(PosixFifoSocketAddress address, int timeoutMillis)
        throws IOException {
    final Log log = LogFactory.getLog(PosixFifoSocket.class);

    if (!address.controlPipe().exists()) {
        throw new IOException("There is no server at " + address);
    }/*www .j a  v a 2s. c  om*/

    File in;
    File out;
    File control;
    long id;
    do {
        id = r.nextLong();
        in = new File(address.socketsDir(), id + ".fifo.out");
        out = new File(address.socketsDir(), id + ".fifo.in");
        control = new File(address.socketsDir(), id + ".fifo.control");
    } while (out.exists() || in.exists());

    createFifo(in);
    createFifo(control);

    final String registrationString = "{" + id + "}";
    if (log.isDebugEnabled())
        log.debug("Sending registration " + registrationString);
    Writer w = new FileWriter(address.controlPipe());
    w.write(registrationString);
    w.flush();

    if (log.isDebugEnabled())
        log.debug("Sent Registration " + registrationString);

    PosixFifoSocket socket = new PosixFifoSocket(id, in, out);
    Reader r = new FileReader(control);

    StringBuilder text = new StringBuilder();
    for (int c = r.read(); c != -1 && c != '\n'; c = r.read()) {
        // READ UNTIL THE FIRST LINE BREAK
        text.append((char) c);
    }
    r.close();
    if (!control.delete()) {
        throw new RuntimeException("Could not delete file:" + control.getAbsolutePath());
    }
    if (!text.toString().equals("OK")) {
        throw new RuntimeException("Connection error: received \"" + text + "\"");
    }
    return socket;
}

From source file:com.jpeterson.util.etag.FileETagTest.java

/**
 * Create the test case//from   ww  w .  j  a  va 2  s. c  o m
 * 
 * @param testName
 *            name of the test case
 */
public FileETagTest(String testName) {
    super(testName);

    logger = LogFactory.getLog(this.getClass());
    logger.debug("FileETagTest");
}

From source file:net.mikaboshi.intra_mart.tools.log_stats.parser.GenericLogParser.java

/**
 * ??/*from   w  ww. j  ava  2  s  .  co m*/
 * @return
 */
protected Log getLogger() {
    if (this.logger == null) {
        this.logger = LogFactory.getLog(getClass());
    }
    return this.logger;
}