Example usage for org.apache.commons.logging Log debug

List of usage examples for org.apache.commons.logging Log debug

Introduction

In this page you can find the example usage for org.apache.commons.logging Log debug.

Prototype

void debug(Object message);

Source Link

Document

Logs a message with debug log level.

Usage

From source file:kr.co.aim.nanoframe.orm.SQLLogUtil.java

public static void logAfterUpdate(int result, Log log) {
    if (log.isDebugEnabled())
        log.debug("SQL update affected " + result + " rows");
}

From source file:arena.mail.MailAddressUtils.java

/**
 * Builds a list of internet address objects by parsing the
 * address list of the form "name <email>, name <email>"
 *//*from ww w  .ja  v  a2  s. c  o  m*/
public static InternetAddress[] parseAddressList(String addressList, String delim, String encoding) {
    if ((addressList == null) || (addressList.trim().length() == 0)) {
        return new InternetAddress[0];
    }
    Log log = LogFactory.getLog(MailAddressUtils.class);
    log.debug("Address list for parsing: " + addressList);
    StringTokenizer st = new StringTokenizer(addressList.trim(), delim);
    List<InternetAddress> addresses = new ArrayList<InternetAddress>();

    for (int n = 0; st.hasMoreTokens(); n++) {
        String fullAddress = st.nextToken().trim();
        if (fullAddress.equals("")) {
            continue;
        }

        try {
            int openPos = fullAddress.indexOf('<');
            int closePos = fullAddress.indexOf('>');

            if (openPos == -1) {
                addresses.add(new InternetAddress(
                        (closePos == -1) ? fullAddress.trim() : fullAddress.substring(0, closePos).trim()));
            } else if (closePos == -1) {
                addresses.add(new InternetAddress(fullAddress.substring(openPos + 1).trim(),
                        fullAddress.substring(0, openPos).trim(), encoding));
            } else {
                addresses.add(new InternetAddress(fullAddress.substring(openPos + 1, closePos).trim(),
                        fullAddress.substring(0, openPos).trim(), encoding));
            }
        } catch (Throwable err) {
            throw new RuntimeException("Error parsing address: " + fullAddress, err);
        }
    }

    log.debug("Found mail addresses: " + addresses);

    return (InternetAddress[]) addresses.toArray(new InternetAddress[addresses.size()]);
}

From source file:com.adaptris.security.util.SecurityUtil.java

/**
 * Print out all the algorithms provided by each provider to the specified
 * logger.//www  .j  a  v  a  2  s .c  om
 *
 * @param logR the Log to be used for this output.
 */
public static void printAlgorithms(Log logR) {
    if (logR.isDebugEnabled() && Constants.DEBUG) {
        logR.debug(getAlgorithms());
    }
}

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

/**
 * Wraps {@link Log#debug(String)}// w  w  w.j  av a2 s . c  om
 * 
 * @param pattern to format against
 * @param objs an array of objects used as parameters to the <code>pattern</code>
 */
public static final void debug(String pattern, Object... objs) {
    Log log = getLog();
    if (log.isDebugEnabled()) {
        log.debug(getMessage(pattern, objs));
    }
}

From source file:kr.co.aim.nanoframe.orm.SQLLogUtil.java

public static void logAfterQuery(Object result, Log log) {
    if (log.isDebugEnabled()) {
        if (result instanceof List)
            log.debug("SQL query returned " + ((List) result).size() + " rows");
        else if (result instanceof DataInfo)
            log.debug("SQL query returned 1 rows");
        else/*from  w ww.  j  ava  2  s. co  m*/
            log.debug("SQL query returned " + (Integer) result);
    }
}

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

/**
 * Writes a debug log entry if debugging is enabled
 *
 * @author OnCore Consulting LLC/*from   w  w w .  j a va2  s  .c o m*/
 *
 * @param log a handle to the log
 * @param message the text to log
 */
public static void debug(final Log log, final String message) {
    if (log != null && message != null) {
        if (log.isDebugEnabled()) {
            log.debug(message);
        }

    }
}

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

/**
 * Log a message with debug log level.//from   ww  w.  j  a va2  s  .  c o m
 *
 * @param message log this message
 */
public static void debug(final Log log, final Object... message) {
    if (log.isDebugEnabled())
        log.debug(concat(message));
}

From source file:net.sf.janos.util.ui.ImageUtilities.java

/**
 * Loads an image from the provided resource
 * @param resource the image to load/*from w ww  .  jav a  2s.co  m*/
 * @return the loaded image, or null if an error occurred
 */
public static ImageData loadImageData(URL resource) {
    if (resource == null) {
        return null;
    }
    ImageData data = null;
    synchronized (IMAGE_DATA_CACHE) {
        try {
            data = IMAGE_DATA_CACHE.get(resource);
            return data;
        } catch (NoSuchKeyException e) {
            // fall through
        }
    }
    InputStream is = null;
    try {
        is = resource.openStream();
        data = new ImageData(is);
        synchronized (IMAGE_DATA_CACHE) {
            IMAGE_DATA_CACHE.put(resource, data);
        }
    } catch (FileNotFoundException e) {
        Log log = LogFactory.getLog(ImageUtilities.class);
        log.debug("Image file " + resource + " does not exist");
        synchronized (IMAGE_DATA_CACHE) {
            IMAGE_DATA_CACHE.put(resource, null);
        }
    } catch (IOException e) {
        Log log = LogFactory.getLog(ImageUtilities.class);
        log.error("Couldn't load image from " + resource, e);
    } finally {
        try {
            is.close();
        } catch (Exception e) {
        }
    }
    return data;
}

From source file:net.gleamynode.netty2.SessionLog.java

public static void debug(Log log, Session session, Object obj) {
    log.debug(getMessage(session, obj));
}

From source file:framework.retrieval.engine.common.RetrievalUtil.java

public static void debugLog(Log log, Object msg) {
    if (log.isDebugEnabled()) {
        log.debug(msg);
    }
}