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

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

Introduction

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

Prototype

boolean isDebugEnabled();

Source Link

Document

Is debug logging currently enabled?

Usage

From source file:hadoopInstaller.logging.CompositeLog.java

@Override
public boolean isDebugEnabled() {
    boolean enabled = true;
    for (Log log : this.logs) {
        enabled = enabled && log.isDebugEnabled();
    }/* w  w w  . ja  v a  2 s .co m*/
    return enabled;
}

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

@Override
protected VitamLogLevel getLevelSpecific() {
    final Log logger = LogFactory.getFactory().getInstance("foo");
    if (logger.isTraceEnabled()) {
        return VitamLogLevel.TRACE;
    } else if (logger.isDebugEnabled()) {
        return VitamLogLevel.DEBUG;
    } else if (logger.isInfoEnabled()) {
        return VitamLogLevel.INFO;
    } else if (logger.isWarnEnabled()) {
        return VitamLogLevel.WARN;
    } else if (logger.isErrorEnabled()) {
        return VitamLogLevel.ERROR;
    }//from  w ww.  j  av a2 s .  c  o m
    return null;
}

From source file:io.netty.logging.CommonsLoggerTest.java

@Test
public void testIsDebugEnabled() {
    Log mock = createStrictMock(Log.class);

    expect(mock.isDebugEnabled()).andReturn(true);
    replay(mock);//  w w  w  .ja v  a 2 s  .c o m

    InternalLogger logger = new CommonsLogger(mock, "foo");
    assertTrue(logger.isDebugEnabled());
    verify(mock);
}

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

@Test
public void testIsDebugEnabled() {
    final Log mock = createStrictMock(Log.class);

    expect(mock.isDebugEnabled()).andReturn(true);
    replay(mock);//  www .j ava2s .co  m

    final VitamLogger logger = new CommonsLogger(mock, "foo");
    assertTrue(logger.isDebugEnabled());
    verify(mock);
}

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

/** {@inheritDoc} **/
public Object invoking(final PicoContainer container, final ComponentAdapter<?> componentAdapter,
        final Member member, final Object instance, final Object... args) {
    Log log = getLog(member);
    if (log.isDebugEnabled()) {
        log.debug(ComponentMonitorHelper.format(ComponentMonitorHelper.INVOKING, memberToString(member),
                instance));/*from w  w  w  . j  a  va 2  s  .c  om*/
    }
    return delegate.invoking(container, componentAdapter, member, instance, args);
}

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

/** {@inheritDoc} **/
public void invoked(final PicoContainer container, final ComponentAdapter<?> componentAdapter,
        final Member member, final Object instance, final long duration, final Object retVal,
        final Object... args) {
    Log log = getLog(member);
    if (log.isDebugEnabled()) {
        log.debug(ComponentMonitorHelper.format(ComponentMonitorHelper.INVOKED, memberToString(member),
                instance, duration));//from  w w  w .  j av a  2 s  .  c o m
    }
    delegate.invoked(container, componentAdapter, member, instance, duration, retVal, args);
}

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

/** {@inheritDoc} **/
public <T> Constructor<T> instantiating(final PicoContainer container,
        final ComponentAdapter<T> componentAdapter, final Constructor<T> constructor) {
    Log log = getLog(constructor);
    if (log.isDebugEnabled()) {
        log.debug(/*from  w w  w . ja v a 2  s.  c  o  m*/
                ComponentMonitorHelper.format(ComponentMonitorHelper.INSTANTIATING, ctorToString(constructor)));
    }
    return delegate.instantiating(container, componentAdapter, constructor);
}

From source file:com.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 != null ? instantiated.getClass().getName() : " null ",
                parmsToString(parameters)));
    }/*from  w  ww .  j  ava  2s. c o  m*/
    delegate.instantiated(container, componentAdapter, constructor, instantiated, parameters, duration);
}

From source file:com.amazon.carbonado.repo.tupl.LogEventListener.java

@Override
public void notify(EventType type, String message, Object... args) {
    int intLevel = type.level.intValue();

    Log log = mLog;
    if (log != null) {
        if (intLevel <= Level.INFO.intValue()) {
            if (type.category == EventType.Category.CHECKPOINT) {
                if (log.isDebugEnabled()) {
                    log.debug(format(type, message, args));
                }//w ww  . j  a  v  a  2  s.  c o m
            } else if (log.isInfoEnabled()) {
                log.info(format(type, message, args));
            }
        } else if (intLevel <= Level.WARNING.intValue()) {
            if (log.isWarnEnabled()) {
                log.warn(format(type, message, args));
            }
        } else if (intLevel <= Level.SEVERE.intValue()) {
            if (log.isFatalEnabled()) {
                log.fatal(format(type, message, args));
            }
        }
    }

    if (intLevel > Level.WARNING.intValue() && mPanicHandler != null) {
        mPanicHandler.onPanic(mDatabase, type, message, args);
    }
}

From source file:javadz.beanutils.MethodUtils.java

/**
 * Gets the class for the primitive type corresponding to the primitive wrapper class given.
 * For example, an instance of <code>Boolean.class</code> returns a <code>boolean.class</code>. 
 * @param wrapperType the //from   w  w  w  . j a va2s .c om
 * @return the primitive type class corresponding to the given wrapper class,
 * null if no match is found
 */
public static Class getPrimitiveType(Class wrapperType) {
    // does anyone know a better strategy than comparing names?
    if (Boolean.class.equals(wrapperType)) {
        return boolean.class;
    } else if (Float.class.equals(wrapperType)) {
        return float.class;
    } else if (Long.class.equals(wrapperType)) {
        return long.class;
    } else if (Integer.class.equals(wrapperType)) {
        return int.class;
    } else if (Short.class.equals(wrapperType)) {
        return short.class;
    } else if (Byte.class.equals(wrapperType)) {
        return byte.class;
    } else if (Double.class.equals(wrapperType)) {
        return double.class;
    } else if (Character.class.equals(wrapperType)) {
        return char.class;
    } else {
        Log log = LogFactory.getLog(MethodUtils.class);
        if (log.isDebugEnabled()) {
            log.debug("Not a known primitive wrapper class: " + wrapperType);
        }
        return null;
    }
}