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.amazonaws.client.metrics.jmx.MBeans.java

/**
 * Registers the given MBean under the given object name to the first
 * registered MBean server, or the platform MBean server if there is no
 * explicitly registered MBean server.//from  www. j a  v  a 2s .  co m
 * 
 * @return true if the registration succeeded, or false if an MBean already
 *         exists under the given object name.
 * @throws MBeanRegistrationException
 *             The preRegister (MBeanRegistration interface) method of the
 *             MBean has thrown an exception. The MBean will not be
 *             registered.
 */
public static <T> boolean registerMBean(String objectName, T mbean) throws MBeanRegistrationException {
    MBeanServer server = getMBeanServer();
    try {
        server.registerMBean(mbean, new ObjectName(objectName));
    } catch (MalformedObjectNameException e) {
        throw new IllegalArgumentException(e);
    } catch (NotCompliantMBeanException e) {
        throw new IllegalArgumentException(e);
    } catch (InstanceAlreadyExistsException e) {
        LogFactory.getLog(MBeans.class).debug("Failed to register mbean " + objectName, e);
        return false;
    }
    return true;
}

From source file:com.mindquarry.desktop.model.task.TaskListTransformer.java

public TaskListTransformer(String login, String password) {
    this.login = login;
    this.password = password;

    log = LogFactory.getLog(TaskListTransformer.class);
}

From source file:com.sohlman.profiler.reporter.CommonsLoggingReporter.java

public CommonsLoggingReporter(long thresHoldMillis, String rowIdentifier, String thresholdReachedIdentifier,
        boolean isThresholdReportEnabled) {
    this(thresHoldMillis, rowIdentifier, thresholdReachedIdentifier,
            LogFactory.getLog(CommonsLoggingReporter.class));
}

From source file:edu.harvard.hms.dbmi.bd2k.irct.ws.rs.resultconverter.CSVTabularDataConverter.java

public CSVTabularDataConverter() {
    log = LogFactory.getLog("CSV Tabular Data Converter");
}

From source file:com.jpeterson.littles3.bo.BucketTest.java

/**
 * Create the test case//from w ww.  j ava2  s .  com
 * 
 * @param testName
 *            name of the test case
 */
public BucketTest(String testName) {
    super(testName);

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

From source file:com.rodaxsoft.mailgun.AbstractMailgunRoutine.java

/**
 * Constructor
 * @param account Mailgun account
 */
protected AbstractMailgunRoutine(MailgunAccount account) {
    this.account = account;
    sLog = LogFactory.getLog(getClass());
}

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

@Override
public VitamLogger newInstance(final String name) {
    return new CommonsLogger(LogFactory.getLog(name), name);
}

From source file:com.thoughtworks.go.agent.bootstrapper.BootstrapperLoggingHelper.java

private static void setupDefaultLog4j() {
    String logFile = System.getenv("LOG_FILE");
    System.out.println("logFile Environment Variable= " + logFile);
    try {//  w w  w  .  jav a  2 s  .c  o  m
        if (logFile == null) {
            logFile = "go-agent-bootstrapper.log";
        }
        System.out.println("Logging to " + logFile);
        BasicConfigurator.configure(new FileAppender(LOG4J_PATTERN, logFile));
        Logger.getRootLogger().setLevel(Level.INFO);
    } catch (IOException e) {
        BasicConfigurator.configure(new ConsoleAppender(LOG4J_PATTERN));
        Logger.getRootLogger().setLevel(Level.INFO);
        Log LOG = LogFactory.getLog(BootstrapperLoggingHelper.class);
        LOG.warn("Unable to initialize log4j file-appender: " + logFile, e);
        LOG.warn("Using console-appender instead");
    }

}

From source file:com.jpeterson.littles3.bo.AuthenticatedUsersGroupTest.java

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

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

From source file:com.lfv.yada.data.server.ServerBundle.java

public ServerBundle(Document doc) {
    log = LogFactory.getLog(getClass());
    this.doc = doc;

    log.debug("Creating server bundle");
    channelMap = new TreeMap<Integer, ServerChannel>();
    terminalMap = new TreeMap<Integer, ServerTerminal>();

    log.debug("Adding COMMON, PHONE and FORWARD channels");
    channelMap.put(CHANNEL_COMMON, new ServerChannel(CHANNEL_COMMON));
    channelMap.put(CHANNEL_PHONE, new ServerChannel(CHANNEL_PHONE));
    channelMap.put(CHANNEL_FORWARD, new ServerChannel(CHANNEL_FORWARD));

    synchronized (doc) {

        // Add channels from configuration
        Element egd = doc.getRootElement().getChild("GroupDefs");
        Element ecd = doc.getRootElement().getChild("ChannelDefs");

        Iterator iter = ecd.getChildren().iterator();
        while (iter.hasNext()) {
            Element ec = (Element) iter.next();
            int channelId = DomTools.getAttributeInt(ec, "id", 0, true);
            if (channelId > 0) {
                // Add one channel for each group
                Iterator iter2 = egd.getChildren().iterator();
                while (iter2.hasNext()) {
                    Element eg = (Element) iter2.next();
                    int groupId = DomTools.getAttributeInt(eg, "id", 0, true);
                    if (groupId > 0) {
                        int globalChannelId = (groupId << ID_BITSHIFT) | channelId;
                        log.debug("Adding channel " + globalChannelId);
                        channelMap.put(globalChannelId, new ServerChannel(globalChannelId));
                    } else {
                        log.warn("Invalid id attribute on group (must be >0), skipping");
                    }/*from   www. j a  v a 2s  . c o m*/
                }
            } else {
                log.warn("Invalid id attribute on channel (must be >0), skipping");
            }
        }

        // Add terminals from configuration
        Element etd = doc.getRootElement().getChild("TerminalDefs");
        iter = etd.getChildren().iterator();
        while (iter.hasNext()) {
            Element et = (Element) iter.next();
            int terminalId = DomTools.getAttributeInt(et, "id", 0, true);
            if (terminalId > 0) {
                log.debug("Adding terminal " + terminalId);
                ServerTerminal terminal = new ServerTerminal(terminalId);
                terminalMap.put(terminalId, terminal);
            } else {
                log.warn("Invalid id attribute on terminal (must be >0), skipping");
            }
        }
    }
}