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:org.ops4j.gaderian.strategy.TestStrategyFactory.java

public void testParameterIndex() throws Exception {
    Registry r = buildFrameworkRegistry("ParameterIndexTest.xml", false);
    LoggingStrategy loggingStrategy = (LoggingStrategy) r.getService(LoggingStrategy.class);
    Log log = createMock(Log.class);
    final Date now = new Date();
    log.debug("Hello, World!");
    log.debug(MessageFormat.format("{0,date,MM/dd/yyyy}", new Object[] { now }));
    replayAllRegisteredMocks();/*  w ww  .j  a v a  2  s.  com*/
    loggingStrategy.log(log, "Hello, World!");
    loggingStrategy.log(log, now);

    verifyAllRegisteredMocks();
}

From source file:org.pentaho.database.service.ServiceLoaderDatabaseDialectProvider.java

Predicate<IDatabaseDialect> usableFilter(Log logger) {
    if (logger.isDebugEnabled()) {
        return dialect -> {
            logger.debug(String.format("Checking for presence of %s ( %s )",
                    dialect.getDatabaseType().getName(), dialect.getNativeDriver()));
            boolean result = false;
            if (dialect instanceof IDriverLocator) {
                result = ((IDriverLocator) dialect).isUsable();
            } else if (ClassUtil.canLoadClass(dialect.getNativeDriver())) {
                result = true;/*  ww  w .j a va 2  s  .  c  o m*/
            }
            if (!result) {
                logger.debug(String.format("%s not detected.", dialect.getDatabaseType().getName()));
            }
            return result;
        };
    }
    return dialect -> {
        if (dialect instanceof IDriverLocator) {
            return ((IDriverLocator) dialect).isUsable();
        } else if (ClassUtil.canLoadClass(dialect.getNativeDriver())) {
            return true;
        }
        return false;
    };
}

From source file:org.pentaho.marketplace.domain.services.BasePluginService.java

private void removeFeatureFromKarafBoot(String featureName, String configurationPid, String propertyId) {
    ConfigurationAdmin configurationAdmin = this.getConfigurationAdmin();
    Log logger = this.getLogger();

    try {/*from   w  w  w  .  j a  v a 2 s.c o  m*/
        Configuration configuration = configurationAdmin.getConfiguration(configurationPid);
        Dictionary<String, Object> properties = configuration.getProperties();
        if (properties == null) {
            logger.debug("Configuration " + configurationPid + " has no properties.");
            return;
        }
        String propertyValue = (String) properties.get(propertyId);
        if (propertyValue == null) {
            logger.debug("Property " + propertyId + " not set in configuration " + configurationPid + ".");
            return;
        }

        String newPropertyValue = propertyValue.replaceFirst("," + featureName, "");
        if (!propertyValue.equals(newPropertyValue)) {
            properties.put(propertyId, newPropertyValue);
            configuration.update(properties);
        }
    } catch (IOException e) {
        logger.debug("Unable to access configuration " + configurationPid + ".");
    }
}

From source file:org.pentaho.platform.engine.security.LoggingInterceptor.java

public void before(final Method method, final Object[] args, final Object target) throws Throwable {
    Log logger = LogFactory.getLog(target.getClass());
    if (logger.isDebugEnabled()) {
        logger.debug(Messages.getInstance().getString("LoggingInterceptor.DEBUG_BEGIN_METHOD")); //$NON-NLS-1$
        log(method, args, target);/*  w w w.  j a v a  2 s  .  co m*/
    }
}

From source file:org.pentaho.platform.engine.security.LoggingInterceptor.java

public void afterReturning(final Object returnValue, final Method method, final Object[] args,
        final Object target) throws Throwable {
    Log logger = LogFactory.getLog(target.getClass());
    if (logger.isDebugEnabled()) {
        logger.debug(Messages.getInstance().getString("LoggingInterceptor.DEBUG_END_METHOD")); //$NON-NLS-1$
        log(method, args, target);//from w  w  w.  j a va  2 s  .  co m
        logger.debug(Messages.getInstance().getString("LoggingInterceptor.DEBUG_RETURN_VALUE", //$NON-NLS-1$
                returnValue.getClass().getName(), toString(returnValue)));
    }
}

From source file:org.pentaho.platform.engine.security.LoggingInterceptor.java

public void afterThrowing(final Method method, final Object[] args, final Object target,
        final Throwable exception) {
    Log logger = LogFactory.getLog(target.getClass());
    if (logger.isDebugEnabled()) {
        logger.debug(Messages.getInstance().getString("LoggingInterceptor.DEBUG_EXCEPTION_IN_METHOD")); //$NON-NLS-1$
        log(method, args, target);// w ww  . jav a 2  s  .com
        logger.debug(Messages.getInstance().getString("LoggingInterceptor.DEBUG_EXCEPTION", //$NON-NLS-1$
                exception.getClass().getName(), exception.getMessage()));
        logger.debug(Messages.getInstance().getString("LoggingInterceptor.DEBUG_STACK_TRACE"), exception); //$NON-NLS-1$
    }
}

From source file:org.pentaho.platform.engine.security.LoggingInterceptor.java

private void log(final Method method, final Object[] args, final Object target) {
    Log logger = LogFactory.getLog(target.getClass());
    if (logger.isDebugEnabled()) {
        logger.debug(
                Messages.getInstance().getString("LoggingInterceptor.DEBUG_METHOD_NAME", method.getName())); //$NON-NLS-1$
        logger.debug(Messages.getInstance().getString("LoggingInterceptor.DEBUG_TARGET_OBJECT", //$NON-NLS-1$
                target.getClass().getName(), toString(target)));
        logger.debug(/*w w w  .j av a2s  . c om*/
                Messages.getInstance().getString("LoggingInterceptor.DEBUG_METHOD_ARGS", arrayToString(args))); //$NON-NLS-1$
    }
}

From source file:org.pentaho.reporting.libraries.xmlns.parser.AbstractReadHandlerFactory.java

private void setValueIfNotDefinedAsLegacy(final TagDefinitionKey key, final Class<? extends T> hasCData) {
    final TagDefinitionValue existingValue = tagData.get(key);
    if (existingValue != null && existingValue.isLegacyOverride()) {
        final Log legacyWarningLog = LogFactory.getLog(getClass());
        legacyWarningLog.debug(
                "Module-Configuration ignored as a legacy properties-based configuration exists for " + key);
        return;// ww w  .  ja v  a2s. co  m
    }
    tagData.put(key, new TagDefinitionValue(hasCData.getName(), false));
}

From source file:org.pentaho.test.platform.web.ApplicationContextTest.java

public void testStandaloneApplicationContext() {
    startTest();//from  ww w .ja v a2 s . co  m

    StandaloneApplicationContext sac = new StandaloneApplicationContext(
            PentahoSystem.getApplicationContext().getSolutionPath("test"), "http://localhost:8080/pentaho/"); //$NON-NLS-1$ //$NON-NLS-2$
    sac.setFullyQualifiedServerURL("http://localhost:8080/pentaho");
    SettingsPublisher publisher = new SettingsPublisher();
    StandaloneSession session = new StandaloneSession("BaseTest.DEBUG_JUNIT_SESSION"); //$NON-NLS-1$
    publisher.publish(session);
    Log logger = publisher.getLogger();
    logger.debug("This is a basic test for the logger"); //$NON-NLS-1$

    assertEquals(sac.getFullyQualifiedServerURL(), "http://localhost:8080/pentaho"); //$NON-NLS-1$    
    assertEquals(sac.getSolutionRootPath(), PentahoSystem.getApplicationContext().getSolutionPath("test")); //$NON-NLS-1$

    finishTest();
}

From source file:org.picocontainer.gems.monitors.CommonsLoggingComponentMonitor.java

/** {@inheritDoc} **/
public <T> void instantiated(final PicoContainer container, final ComponentAdapter<T> componentAdapter,
        final Constructor<T> constructor, final Object instantiated, final Object[] parameters,
        final long duration) {
    Log log = getLog(constructor);
    if (log.isDebugEnabled()) {
        log.debug(ComponentMonitorHelper.format(ComponentMonitorHelper.INSTANTIATED, ctorToString(constructor),
                duration, instantiated.getClass().getName(), parmsToString(parameters)));
    }/*from w w  w. j  a  v  a  2  s.co  m*/
    delegate.instantiated(container, componentAdapter, constructor, instantiated, parameters, duration);
}