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.datos.vfs.VfsLog.java

/**
 * debug.//from   w  ww .  j a  v a 2  s . c om
 * @param vfslog The base component Logger to use.
 * @param commonslog The class specific Logger
 * @param message The message to log.
 */
public static void debug(final Log vfslog, final Log commonslog, final String message) {
    if (vfslog != null) {
        vfslog.debug(message);
    } else if (commonslog != null) {
        commonslog.debug(message);
    }
}

From source file:it.doqui.index.ecmengine.client.engine.EcmEngineDelegateFactory.java

private static EcmEngineDelegate getClassInstance(String ecmEngineDelegateImplName, Log logger)
        throws EcmEngineDelegateInstantiationException {
    EcmEngineDelegate classInstance = null;

    logger.debug("[EcmEngineDelegateFactory::getClassInstance] BEGIN");
    try {/*  w w w . ja va 2 s .c  o  m*/
        logger.debug("[EcmEngineDelegateFactory::getClassInstance] " + "Caricamento classe: "
                + ecmEngineDelegateImplName);
        final Class delegateClass = Class.forName(ecmEngineDelegateImplName);
        final Constructor constructor = delegateClass.getConstructor(new Class[] { Log.class });

        classInstance = (EcmEngineDelegate) constructor.newInstance(new Object[] { logger });
    } catch (ClassNotFoundException e) {
        logger.error("[EcmEngineDelegateFactory::getClassInstance] " + "FATAL: classe non trovata.");
        throw new EcmEngineDelegateInstantiationException("Classe non trovata.", e);
    } catch (NoSuchMethodException e) {
        logger.error(
                "[EcmEngineDelegateFactory::getClassInstance] " + "FATAL: nessun costruttore compatibile.");
        throw new EcmEngineDelegateInstantiationException("Nessun costruttore compatibile.", e);
    } catch (InstantiationException e) {
        logger.error("[EcmEngineDelegateFactory::getClassInstance] " + "FATAL: errore di istanziazione.");
        throw new EcmEngineDelegateInstantiationException("Errore di istanziazione.", e);
    } catch (IllegalAccessException e) {
        logger.error("[EcmEngineDelegateFactory::getClassInstance] " + "FATAL: errore di accesso.");
        throw new EcmEngineDelegateInstantiationException("Errore di accesso.", e);
    } catch (InvocationTargetException e) {
        logger.error("[EcmEngineDelegateFactory::getClassInstance] " + "FATAL: eccezione nel target invocato.");
        throw new EcmEngineDelegateInstantiationException("Eccezione nel target invocato.", e);
    } finally {
        logger.debug("[EcmEngineDelegateFactory::getClassInstance] END");
    }
    return classInstance;
}

From source file:com.headissue.pigeon.util.LogUtils.java

public static void debug(Log log, String message, Object... args) {
    if (log.isDebugEnabled()) {
        if (args != null && args.length > 0) {
            message = String.format(message, args);
        }/*from ww  w.j a v  a2s. c o  m*/
        log.debug(message);
    }
}

From source file:edu.umich.robot.util.Configs.java

public static void toLog(Log logger, Config config) {
    if (!logger.isDebugEnabled())
        return;// w  ww  . java2 s  . co  m

    List<String> keys = new LinkedList<String>();
    Collections.addAll(keys, config.getKeys());
    Collections.sort(keys);
    for (String key : keys)
        logger.debug(String.format("%s = %s", key, Arrays.toString(config.getStrings(key))));
}

From source file:it.doqui.index.ecmengine.client.backoffice.EcmEngineBackofficeDelegateFactory.java

private static EcmEngineBackofficeDelegate getClassInstance(String ecmEngineBkoDelegateImplName, Log logger)
        throws EcmEngineBackofficeDelegateInstantiationException {
    EcmEngineBackofficeDelegate classInstance = null;

    logger.debug("[EcmEngineBackofficeDelegateFactory::getClassInstance] BEGIN");
    try {/*from   w  ww .  j ava  2s  .  co m*/
        logger.debug("[EcmEngineBackofficeDelegateFactory::getClassInstance] " + "Caricamento classe: "
                + ecmEngineBkoDelegateImplName);
        final Class delegateClass = Class.forName(ecmEngineBkoDelegateImplName);
        final Constructor constructor = delegateClass.getConstructor(new Class[] { Log.class });
        classInstance = (EcmEngineBackofficeDelegate) constructor.newInstance(new Object[] { logger });
    } catch (ClassNotFoundException e) {
        logger.error("[EcmEngineBackofficeDelegateFactory::getClassInstance] " + "FATAL: classe non trovata.");
        throw new EcmEngineBackofficeDelegateInstantiationException("Classe non trovata.", e);
    } catch (NoSuchMethodException e) {
        logger.error("[EcmEngineBackofficeDelegateFactory::getClassInstance] "
                + "FATAL: nessun costruttore compatibile.");
        throw new EcmEngineBackofficeDelegateInstantiationException("Nessun costruttore compatibile.", e);
    } catch (InstantiationException e) {
        logger.error(
                "[EcmEngineBackofficeDelegateFactory::getClassInstance] " + "FATAL: errore di istanziazione.");
        throw new EcmEngineBackofficeDelegateInstantiationException("Errore di istanziazione.", e);
    } catch (IllegalAccessException e) {
        logger.error("[EcmEngineBackofficeDelegateFactory::getClassInstance] " + "FATAL: errore di accesso.");
        throw new EcmEngineBackofficeDelegateInstantiationException("Errore di accesso.", e);
    } catch (InvocationTargetException e) {
        logger.error("[EcmEngineBackofficeDelegateFactory::getClassInstance] "
                + "FATAL: eccezione nel target invocato.");
        throw new EcmEngineBackofficeDelegateInstantiationException("Eccezione nel target invocato.", e);
    } finally {
        logger.debug("[EcmEngineBackofficeDelegateFactory::getClassInstance] END");
    }
    return classInstance;
}

From source file:com.moss.error_reporting.client.ErrorReportProxyFactory.java

private static ProxyFactory create(ProxyProviderOption option, ProxyProviderOption defaultOption) {

    Log log = LogFactory.getLog(ErrorReportProxyFactory.class);

    if (option == null) {

        if (log.isDebugEnabled()) {
            log.debug(
                    "No option was provided as an argument, attempting to determine option from system property '"
                            + PROXY_PROVIDER_PROPERTY + "'");
        }/*w w w .j a v a 2  s . co m*/

        try {
            String prop = System.getProperty(PROXY_PROVIDER_PROPERTY);
            if (prop != null) {
                option = ProxyProviderOption.valueOf(prop.toUpperCase());

                if (option == null) {
                    if (log.isDebugEnabled()) {
                        log.debug("Could not determine option from system property '" + PROXY_PROVIDER_PROPERTY
                                + "': " + prop);
                    }
                } else {
                    if (log.isDebugEnabled()) {
                        log.debug("Determined option from system property '" + PROXY_PROVIDER_PROPERTY + "': "
                                + option);
                    }
                }
            } else {
                if (log.isDebugEnabled()) {
                    log.debug("The system property '" + PROXY_PROVIDER_PROPERTY
                            + "' was not set, cannot use it to determine which option to use.");
                }
            }
        } catch (Exception ex) {
            log.warn(
                    "Encountered unexpected failure while attempting to determine which option to use from system property '"
                            + PROXY_PROVIDER_PROPERTY + "'",
                    ex);
        }

        if (option == null) {
            if (defaultOption == null) {
                throw new RuntimeException(
                        "No default option was provided, cannot determine which option to use for supplying the proxy provider.");
            } else {
                if (log.isDebugEnabled()) {
                    log.debug("No specific option was chosen, using default option: " + defaultOption);
                }
                option = defaultOption;
            }
        }
    } else {
        if (log.isDebugEnabled()) {
            log.debug("Option " + option + " was provided as an argument, using it directly.");
        }
    }

    ProxyProvider prov = option.makeProvider();
    ProxyFactory factory = new ProxyFactory(prov);

    return factory;
}

From source file:com.moss.identity.veracity.VeracityProxyFactory.java

private static ProxyFactory create(ProxyProviderOption option, ProxyProviderOption defaultOption) {

    Log log = LogFactory.getLog(VeracityProxyFactory.class);

    if (option == null) {

        if (log.isDebugEnabled()) {
            log.debug(
                    "No option was provided as an argument, attempting to determine option from system property '"
                            + PROXY_PROVIDER_PROPERTY + "'");
        }// w ww .j a  v a2 s  .  co m

        try {
            String prop = System.getProperty(PROXY_PROVIDER_PROPERTY);
            if (prop != null) {
                option = ProxyProviderOption.valueOf(prop.toUpperCase());

                if (option == null) {
                    if (log.isDebugEnabled()) {
                        log.debug("Could not determine option from system property '" + PROXY_PROVIDER_PROPERTY
                                + "': " + prop);
                    }
                } else {
                    if (log.isDebugEnabled()) {
                        log.debug("Determined option from system property '" + PROXY_PROVIDER_PROPERTY + "': "
                                + option);
                    }
                }
            } else {
                if (log.isDebugEnabled()) {
                    log.debug("The system property '" + PROXY_PROVIDER_PROPERTY
                            + "' was not set, cannot use it to determine which option to use.");
                }
            }
        } catch (Exception ex) {
            log.warn(
                    "Encountered unexpected failure while attempting to determine which option to use from system property '"
                            + PROXY_PROVIDER_PROPERTY + "'",
                    ex);
        }

        if (option == null) {
            if (defaultOption == null) {
                throw new RuntimeException(
                        "No default option was provided, cannot determine which option to use for supplying the proxy provider.");
            } else {
                if (log.isDebugEnabled()) {
                    log.debug("No specific option was chosen, using default option: " + defaultOption);
                }
                option = defaultOption;
            }
        }
    } else {
        if (log.isDebugEnabled()) {
            log.debug("Option " + option + " was provided as an argument, using it directly.");
        }
    }

    ProxyProvider prov = option.makeProvider();
    ProxyFactory factory = new ProxyFactory(prov);

    return factory;
}

From source file:com.moss.error_reporting.server.TestErrorReportProxyFactory.java

private static ProxyFactory create(ProxyProviderOption option, ProxyProviderOption defaultOption) {

    Log log = LogFactory.getLog(TestErrorReportProxyFactory.class);

    if (option == null) {

        if (log.isDebugEnabled()) {
            log.debug(
                    "No option was provided as an argument, attempting to determine option from system property '"
                            + PROXY_PROVIDER_PROPERTY + "'");
        }//from ww  w.  java2  s.c  o m

        try {
            String prop = System.getProperty(PROXY_PROVIDER_PROPERTY);
            if (prop != null) {
                option = ProxyProviderOption.valueOf(prop.toUpperCase());

                if (option == null) {
                    if (log.isDebugEnabled()) {
                        log.debug("Could not determine option from system property '" + PROXY_PROVIDER_PROPERTY
                                + "': " + prop);
                    }
                } else {
                    if (log.isDebugEnabled()) {
                        log.debug("Determined option from system property '" + PROXY_PROVIDER_PROPERTY + "': "
                                + option);
                    }
                }
            } else {
                if (log.isDebugEnabled()) {
                    log.debug("The system property '" + PROXY_PROVIDER_PROPERTY
                            + "' was not set, cannot use it to determine which option to use.");
                }
            }
        } catch (Exception ex) {
            log.warn(
                    "Encountered unexpected failure while attempting to determine which option to use from system property '"
                            + PROXY_PROVIDER_PROPERTY + "'",
                    ex);
        }

        if (option == null) {
            if (defaultOption == null) {
                throw new RuntimeException(
                        "No default option was provided, cannot determine which option to use for supplying the proxy provider.");
            } else {
                if (log.isDebugEnabled()) {
                    log.debug("No specific option was chosen, using default option: " + defaultOption);
                }
                option = defaultOption;
            }
        }
    } else {
        if (log.isDebugEnabled()) {
            log.debug("Option " + option + " was provided as an argument, using it directly.");
        }
    }

    ProxyProvider prov = option.makeProvider();
    ProxyFactory factory = new ProxyFactory(prov);

    return factory;
}

From source file:it.doqui.index.ecmengine.client.backoffice.EcmEngineBackofficeDelegateFactory.java

/**
 * Metodo factory che crea una nuova istanza del client delegate.
 * /*from  w  ww.  j  ava 2 s . c o  m*/
 * <p>La factory cerca di istanziare la classe di implementazione
 * specificata dall'utente nel file di propriet&agrave;
 * {@code ecmengine-backoffice-delegate.properties}. Se tale operazione fallisce
 * la factory cerca di istanziare la classe di default definita
 * in {@link EcmEngineBackofficeDelegateConstants#ECMENGINE_BKO_DELEGATE_CLASS_NAME_DEFAULT}.
 * </p>
 * 
 * @return Una nuova istanza del client delegate.
 * 
 * @throws EcmEngineBackofficeDelegateInstantiationException Se si verifica un
 * errore nell'istanziazione del client delegate.
 */
public static EcmEngineBackofficeDelegate getEcmEngineBackofficeDelegate()
        throws EcmEngineBackofficeDelegateInstantiationException {
    final ResourceBundle resources = ResourceBundle.getBundle(ECMENGINE_BKO_PROPERTIES_FILE);
    final String caller = resources.getString(ECMENGINE_BKO_DELEGATE_CALLER);
    final Log logger = LogFactory.getLog(caller + ECMENGINE_BKO_DELEGATE_LOG_CATEGORY);
    final String implClass = resources.getString(ECMENGINE_BKO_DELEGATE_CLASS);

    logger.debug("[EcmEngineBackofficeDelegateFactory::getEcmEngineBackofficeDelegate] BEGIN");

    EcmEngineBackofficeDelegate backofficeInstance = null;

    logger.debug("[EcmEngineBackofficeDelegateFactory::getEcmEngineBackofficeDelegate] " + "Classe delegate: "
            + implClass);
    try {
        backofficeInstance = getClassInstance(implClass, logger);
    } catch (EcmEngineBackofficeDelegateInstantiationException e) {
        logger.warn("[EcmEngineBackofficeDelegateFactory::getEcmEngineBackofficeDelegate] "
                + "Impossibile caricare la classe \"" + implClass + "\": " + e.getMessage());

        logger.debug("[EcmEngineBackofficeDelegateFactory::getEcmEngineBackofficeDelegate] "
                + "Classe delegate di default: " + ECMENGINE_BKO_DELEGATE_CLASS_NAME_DEFAULT);
        try {
            backofficeInstance = getClassInstance(ECMENGINE_BKO_DELEGATE_CLASS_NAME_DEFAULT, logger);
        } catch (EcmEngineBackofficeDelegateInstantiationException ex) {
            logger.error("[EcmEngineBackofficeDelegateFactory::getEcmEngineBackofficeDelegate] "
                    + "Impossibile caricare la classe di default \"" + ECMENGINE_BKO_DELEGATE_CLASS_NAME_DEFAULT
                    + "\": " + ex.getMessage());

            throw ex; // Rilancia l'eccezione al chiamante
        }

    } finally {
        logger.debug("[EcmEngineBackofficeDelegateFactory::getEcmEngineBackofficeDelegate] END");
    }

    return backofficeInstance;
}

From source file:net.openhft.chronicle.logger.jcl.JclTestBase.java

protected static void log(Log logger, ChronicleLogLevel level, String message) {
    switch (level) {
    case TRACE:/* www  .  j  ava  2  s  .  c o  m*/
        logger.trace(message);
        break;
    case DEBUG:
        logger.debug(message);
        break;
    case INFO:
        logger.info(message);
        break;
    case WARN:
        logger.warn(message);
        break;
    case ERROR:
        logger.error(message);
        break;
    default:
        throw new UnsupportedOperationException();
    }
}