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:com.agiletec.apsadmin.tags.util.ParamMap.java

@Override
public boolean end(Writer writer, String body) {
    Log log = LogFactory.getLog(ParamMap.class);
    Component component = this.findAncestor(Component.class);
    if (null == this.getMap()) {
        log.info("Attribute map is mandatory.");
        return super.end(writer, body);
    }//from  w  w w .j ava2  s. com
    Object object = this.findValue(this.getMap());
    if (null == object) {
        log.debug("Map not found in ValueStack");
        return super.end(writer, body);
    }
    if (!(object instanceof Map)) {
        log.warn("Error in JSP. Attribute map must evaluate to java.util.Map. Found type: "
                + object.getClass().getName());
        return super.end(writer, body);
    }
    component.addAllParameters((Map) object);
    return super.end(writer, body);
}

From source file:com.legstar.cobol.RecognizerErrorHandler.java

/**
 * Format an error message as expected by ANTLR. It is basically the
 * same error message that ANTL BaseRecognizer generates with some
 * additional data./*from ww w  .ja  v  a 2s  .c  om*/
 * Also used to log debugging information.
 * @param log the logger to use at debug time
 * @param recognizer the lexer or parser who generated the error
 * @param e the exception that occured
 * @param superMessage the error message that the super class generated
 * @param tokenNames list of token names
 * @return a formatted error message
 */
public static String getErrorMessage(final Log log, final BaseRecognizer recognizer,
        final RecognitionException e, final String superMessage, final String[] tokenNames) {
    if (log.isDebugEnabled()) {
        List<?> stack = BaseRecognizer.getRuleInvocationStack(e,
                recognizer.getClass().getSuperclass().getName());
        String debugMsg = recognizer.getErrorHeader(e) + " " + e.getClass().getSimpleName() + ": "
                + superMessage + ":";
        if (e instanceof NoViableAltException) {
            NoViableAltException nvae = (NoViableAltException) e;
            debugMsg += " (decision=" + nvae.decisionNumber + " state=" + nvae.stateNumber + ")"
                    + " decision=<<" + nvae.grammarDecisionDescription + ">>";
        } else if (e instanceof UnwantedTokenException) {
            UnwantedTokenException ute = (UnwantedTokenException) e;
            debugMsg += " (unexpected token=" + toString(ute.getUnexpectedToken(), tokenNames) + ")";

        } else if (e instanceof EarlyExitException) {
            EarlyExitException eea = (EarlyExitException) e;
            debugMsg += " (decision=" + eea.decisionNumber + ")";
        }
        debugMsg += " ruleStack=" + stack.toString();
        log.debug(debugMsg);
    }

    return makeUserMsg(e, superMessage);
}

From source file:com.sos.i18n.logging.commons.CommonsLogMsg.java

/**
 * Logs the given message to the log at the debug level. If the log level is not enabled, this method does
 * nothing and returns <code>null</code>. If a message was logged, its {@link Msg} will be returned.
 *
 * @param  log     the log where the messages will go
 * @param  key     the resource bundle key name
 * @param  varargs arguments to help fill in the resource bundle message
 *
 * @return if the message was logged, a non-<code>null</code> Msg object is returned
 *///  w  w w  .j a  v a 2s.  c  om
public static Msg debug(Log log, String key, Object... varargs) {
    if (log.isDebugEnabled()) {
        Msg msg = Msg.createMsg(key, varargs);
        log.debug((Logger.getDumpLogKeys()) ? ('{' + key + '}' + msg) : msg);
        return msg;
    }

    return null;
}

From source file:gaderian.test.services.TestAssemblyInstruction.java

private void trainDebug(AssemblyParameters fp, Log log, String string) {
    expect(fp.getLog()).andReturn(log);/*w  w  w.  j a v  a 2 s  .c o  m*/

    expect(log.isDebugEnabled()).andReturn(true);

    log.debug(string);
}

From source file:com.tecapro.inventory.common.util.LogUtil.java

/**
 * //from   ww  w . j  a v a2  s  .c  om
 * Debug log output
 * 
 * @param log
 * @param clazz
 * @param method
 * @param time
 */
public void debugLog(Log log, String clazz, String method, InfoValue info, String message) {
    if (log.isDebugEnabled()) {
        log.debug(returnLogString(clazz, method, info, LogPrefix.OTHER, message));
    }
}

From source file:de.itsvs.cwtrpc.controller.AutowiredRemoteServiceGroupConfig.java

public void afterPropertiesSet() {
    final Log log;
    final ListableBeanFactory beanFactory;
    final String[] beanNames;
    final List<RemoteServiceConfig> serviceConfigs;

    log = LogFactory.getLog(AutowiredRemoteServiceGroupConfig.class);
    log.debug("Searching for remote services");

    beanFactory = getApplicationContext();
    beanNames = BeanFactoryUtils.beanNamesForTypeIncludingAncestors(beanFactory, RemoteService.class, true,
            false);//from  www .j  a va 2  s . c om
    if (beanNames.length == 0) {
        return;
    }

    serviceConfigs = new ArrayList<RemoteServiceConfig>();
    for (String beanName : beanNames) {
        final Class<?> beanType;
        final Class<?> serviceInterface;

        beanType = beanFactory.getType(beanName);
        serviceInterface = getRemoteServiceInterface(beanType);
        if (serviceInterface != null) {
            if (serviceInterface.getAnnotation(RemoteServiceRelativePath.class) != null) {
                if (isAcceptedServiceInterface(serviceInterface)) {
                    if (log.isDebugEnabled()) {
                        log.debug("Adding service '" + beanName + "'");
                    }
                    serviceConfigs.add(new RemoteServiceConfig(beanName));
                }
            } else {
                if (log.isDebugEnabled()) {
                    log.debug("Ignoring service '" + beanName + "' since service does not specify "
                            + "remote service relative path");
                }
            }
        } else {
            if (log.isInfoEnabled()) {
                log.info("Ignoring service '" + beanName + "' since it implements multiple "
                        + "remote service interfaces");
            }
        }
    }

    setServiceConfigs(serviceConfigs);
}

From source file:com.sos.i18n.logging.commons.CommonsLogMsg.java

/**
 * Logs the given message to the log at the debug level. If the log level is not enabled, this method does
 * nothing and returns <code>null</code>. If a message was logged, its {@link Msg} will be returned.
 *
 * @param  log     the log where the messages will go
 * @param  locale  the locale to determine what bundle to use
 * @param  key     the resource bundle key name
 * @param  varargs arguments to help fill in the resource bundle message
 *
 * @return if the message was logged, a non-<code>null</code> Msg object is returned
 *//*from   www  . j  a va2  s  . co  m*/
public static Msg debug(Log log, Locale locale, String key, Object... varargs) {
    if (log.isDebugEnabled()) {
        Msg msg = Msg.createMsg(locale, key, varargs);
        log.debug((Logger.getDumpLogKeys()) ? ('{' + key + '}' + msg) : msg);
        return msg;
    }

    return null;
}

From source file:com.github.cmisbox.core.Queue.java

public void manageEvent(LocalEvent event) {
    Log log = LogFactory.getLog(this.getClass());
    log.debug("managing: " + event);

    // any platform
    // - a folder can be renamed before containing files are managed: on
    // folder rename all children must be updated while still in queue;

    // linux//w ww.jav  a 2s  .com
    // - if a file or folder is moved out of a watched folder it is reported
    // as a rename to null (check if it's still there)

    // mac osx
    // - recursive folder operations (e.g. unzip an archive or move a folder
    // inside a watched folder) are not reported, only root folder is
    // reported as create
    // - folder rename causes children to be notified as deleted (with old
    // path)

    try {
        if (event.isSynch()) {
            this.synchAllWatches();
            return;
        }

        File f = new File(event.getFullFilename());
        if (event.isCreate()) {
            StoredItem item = this.getSingleItem(event.getLocalPath());

            if ((item != null) && (item.getLocalModified().longValue() >= f.lastModified())) {
                return;
            }
            String parent = f.getParent().substring(Config.getInstance().getWatchParent().length());

            CmisObject obj = CMISRepository.getInstance().addChild(this.getSingleItem(parent).getId(), f);
            Storage.getInstance().add(f, obj);
        } else if (event.isDelete()) {
            StoredItem item = this.getSingleItem(event.getLocalPath());
            if (f.exists()) {
                throw new Exception(
                        String.format("File %s reported to be deleted but stil exists", f.getAbsolutePath()));
            }
            CMISRepository.getInstance().delete(item.getId());
            Storage.getInstance().delete(item, true);
        } else if (event.isModify()) {
            if (f.isFile()) {
                StoredItem item = this.getSingleItem(event.getLocalPath());

                if (item.getLocalModified().longValue() < f.lastModified()) {

                    Document doc = CMISRepository.getInstance().update(item, f);

                    Storage.getInstance().localUpdate(item, f, doc);
                } else {
                    log.debug("file" + f + " modified in the past");
                }

            }
        } else if (event.isRename()) {
            StoredItem item = this.getSingleItem(event.getLocalPath());
            CmisObject obj = CMISRepository.getInstance().rename(item.getId(), f);
            Storage.getInstance().localUpdate(item, f, obj);
        }

    } catch (Exception e) {
        log.error(e);
        if (log.isDebugEnabled()) {
            e.printStackTrace();
        }
        if (UI.getInstance().isAvailable()) {
            UI.getInstance().notify(e.toString());
            UI.getInstance().setStatus(Status.KO);
        }
    }
}

From source file:com.sos.i18n.logging.commons.CommonsLogMsg.java

/**
 * Logs the given message to the log at the debug level. If the log level is not enabled, this method does
 * nothing and returns <code>null</code>. If a message was logged, its {@link Msg} will be returned.
 *
 * @param  log      the log where the messages will go
 * @param  basename the base name of the resource bundle
 * @param  key      the resource bundle key name
 * @param  varargs  arguments to help fill in the resource bundle message
 *
 * @return if the message was logged, a non-<code>null</code> Msg object is returned
 *///  w w  w .  ja v  a  2  s  .  com
public static Msg debug(Log log, BundleBaseName basename, String key, Object... varargs) {
    if (log.isDebugEnabled()) {
        Msg msg = Msg.createMsg(basename, key, varargs);
        log.debug((Logger.getDumpLogKeys()) ? ('{' + key + '}' + msg) : msg);
        return msg;
    }

    return null;
}

From source file:edu.cornell.mannlib.vitro.webapp.controller.VitroHttpServlet.java

/**
 * A child class may call this if logging is set to debug level.
 *///from  w  w  w.j  av a 2 s .  c o  m
protected void dumpRequestParameters(HttpServletRequest req) {
    Log subclassLog = LogFactory.getLog(this.getClass());

    @SuppressWarnings("unchecked")
    Map<String, String[]> map = req.getParameterMap();

    for (String key : map.keySet()) {
        String[] values = map.get(key);
        subclassLog.debug("Parameter '" + key + "' = " + Arrays.deepToString(values));
    }
}