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.pcms.common.Common.java

@SuppressWarnings("unchecked")
public Common() {
    _log = LogFactory.getLog(getClass());
}

From source file:eu.planets_project.tb.impl.persistency.CommentPersistencyImpl.java

/**
 * A Factory method to build a reference to this interface.
 * @return//w  w  w  . ja v  a 2  s.  co  m
 */
public static CommentPersistencyRemote getInstance() {
    Log log = LogFactory.getLog(CommentPersistencyImpl.class);
    try {
        Context jndiContext = new javax.naming.InitialContext();
        CommentPersistencyRemote dao_r = (CommentPersistencyRemote) PortableRemoteObject.narrow(
                jndiContext.lookup("testbed/CommentPersistencyImpl/remote"), CommentPersistencyRemote.class);
        return dao_r;
    } catch (NamingException e) {
        log.error("Failure in getting PortableRemoteObject: " + e.toString());
        return null;
    }
}

From source file:de.xwic.appkit.core.util.StreamUtil.java

/**
 * @param closable/*  ww  w .java 2  s .  c o m*/
 * @param log
 */
public static void close(final Closeable... closables) {
    close(LogFactory.getLog(StreamUtil.class), closables);
}

From source file:eu.planets_project.tb.impl.persistency.ServiceRecordPersistencyImpl.java

/**
 * A Factory method to build a reference to this interface.
 * @return//from  ww w .  j  a va2s  .  c o m
 */
public static ServiceRecordPersistencyRemote getInstance() {
    Log log = LogFactory.getLog(ServiceRecordPersistencyImpl.class);
    try {
        Context jndiContext = new javax.naming.InitialContext();
        ServiceRecordPersistencyRemote dao_r = (ServiceRecordPersistencyRemote) PortableRemoteObject.narrow(
                jndiContext.lookup("testbed/ServiceRecordPersistencyImpl/remote"),
                ServiceRecordPersistencyRemote.class);
        return dao_r;
    } catch (NamingException e) {
        log.error("Failure in getting PortableRemoteObject: " + e.toString());
        return null;
    }
}

From source file:business.controllers.LabProfileController.java

@RequestMapping(value = "/public/labs", method = RequestMethod.GET)
public List<Lab> get() {
    LogFactory.getLog(getClass()).info("GET /labs/ for anonymous user");
    return labService.findAllActive();
}

From source file:net.sf.nmedit.jpatch.clavia.nordmodular.NM1ModuleDescriptions.java

public static NM1ModuleDescriptions parse(ClassLoader loader, InputStream stream)
        throws ParserConfigurationException, SAXException, IOException {
    NM1ModuleDescriptions mod = new NM1ModuleDescriptions(loader);

    try {/* w  ww . j a  va2s  . c  o m*/
        ModuleDescriptionsParser.parse(mod, stream);
    } catch (SAXParseException spe) {
        Log log = LogFactory.getLog(NM1ModuleDescriptions.class);
        if (log.isErrorEnabled()) {
            log.error("error in parse(" + loader + "," + stream + "); " + "@" + spe.getLineNumber() + ":"
                    + spe.getColumnNumber(), spe);
        }
    }
    return mod;
}

From source file:mangotiger.poker.channel.EventChannelImpl.java

private static Log log() {
    return LogFactory.getLog(EventChannelImpl.class);
}

From source file:alluxio.util.LogUtils.java

/**
 * Gets a logger's level with specify name, if the level argument is not null, it will set to
 * specify level first./*from  ww w  .j a  va2  s .  c  o m*/
 * @param logName logger's name
 * @param level logger's level
 * @return an entity object about the log info
 * @throws IOException if an I/O error occurs
 */
public static LogInfo setLogLevel(String logName, String level) throws IOException {
    LogInfo result = new LogInfo();
    if (StringUtils.isNotBlank(logName)) {
        result.setLogName(logName);
        Log log = LogFactory.getLog(logName);
        Logger logger = LoggerFactory.getLogger(logName);
        if (log instanceof Log4JLogger) {
            process(((Log4JLogger) log).getLogger(), level, result);
        } else if (log instanceof Jdk14Logger) {
            process(((Jdk14Logger) log).getLogger(), level, result);
        } else if (logger instanceof Log4jLoggerAdapter) {
            try {
                Field field = Log4jLoggerAdapter.class.getDeclaredField("logger");
                field.setAccessible(true);
                org.apache.log4j.Logger log4jLogger = (org.apache.log4j.Logger) field.get(logger);
                process(log4jLogger, level, result);
            } catch (NoSuchFieldException | IllegalAccessException e) {
                result.setMessage(e.getMessage());
            }
        } else {
            result.setMessage("Sorry, " + log.getClass() + " not supported.");
        }
    } else {
        result.setMessage("Please specify a correct logName.");
    }
    return result;
}

From source file:fr.aliasource.webmail.proxy.impl.ProxyAction.java

public ProxyAction(IAccount ac) {
    this.logger = LogFactory.getLog(getClass());
    this.account = ac;
}

From source file:net.sf.nmedit.jtheme.JTCursor.java

private static Cursor createCursor(int id) {
    Toolkit tk = Toolkit.getDefaultToolkit();
    URL res = getResource(id);/*from w  ww. j  av a 2 s .  c o  m*/

    if (res == null) {
        Log log = LogFactory.getLog(JTCursor.class);
        if (log.isWarnEnabled()) {
            log.warn("Could not find cursor: id=" + id + ", url=" + res);
        }
        return Cursor.getDefaultCursor();
    }

    Image img;
    try {
        img = ImageIO.read(res);
    } catch (IOException e) {
        Log log = LogFactory.getLog(JTCursor.class);
        if (log.isWarnEnabled()) {
            log.warn("Could not find cursor: id=" + id + ", url=" + res, e);
        }
        return Cursor.getDefaultCursor();
    }

    return tk.createCustomCursor(img, new Point(4, 16), names[id]);
}