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:org.apache.nutch.util.ThreadPool.java

/**
 * Turn off the pool.  Every thread, when finished with
 * its current work, will realize that the pool is no
 * longer running, and will exit./*from www.ja v  a 2 s .  com*/
 */
public void shutdown() {
    running = false;
    Log l = LogFactory.getLog("org.apache.nutch.util");
    if (l.isDebugEnabled()) {
        l.debug("ThreadPool shutting down.");
    }
}

From source file:org.apache.ojb.broker.util.logging.CommonsLoggerImpl.java

/**
* @see org.apache.ojb.broker.util.logging.Logger#isEnabledFor(int)
*//*ww  w .ja  v  a  2  s . c o  m*/
public boolean isEnabledFor(int priority) {
    Log commonsLog = getLog();
    switch (priority) {
    case Logger.DEBUG:
        return commonsLog.isDebugEnabled();
    case Logger.INFO:
        return commonsLog.isInfoEnabled();
    case Logger.WARN:
        return commonsLog.isWarnEnabled();
    case Logger.ERROR:
        return commonsLog.isErrorEnabled();
    case Logger.FATAL:
        return commonsLog.isFatalEnabled();
    }
    return false;
}

From source file:org.apache.ranger.plugin.util.RangerPerfTracer.java

public static boolean isPerfTraceEnabled(Log logger) {
    return logger.isDebugEnabled();
}

From source file:org.apache.ranger.plugin.util.RangerPerfTracerFactory.java

static RangerPerfTracer getPerfTracer(Log logger, String tag, String data) {

    RangerPerfTracer ret = null;// ww  w . j a va 2 s  .  c om

    if (PerfDataRecorder.collectStatistics()) {
        ret = new RangerPerfCollectorTracer(logger, tag, data);
    } else if (logger.isDebugEnabled()) {
        ret = new RangerPerfTracer(logger, tag, data);
    }
    return ret;
}

From source file:org.apache.synapse.handler.util.HandlerUtil.java

/**
 * Helper util method to get the logging done whenever injecting the message into synapse
 *
 * @param log - Log appender to be used to append logs
 * @param messageContext - MessageContext which will be logged
 *///from w  w w. ja  va2s  . com
public static void doHandlerLogging(Log log, MessageContext messageContext) {
    if (log.isDebugEnabled()) {
        log.debug("Synapse handler received a new message for message mediation...");
        log.debug("Received To: "
                + (messageContext.getTo() != null ? messageContext.getTo().getAddress() : "null"));
        log.debug("SOAPAction: "
                + (messageContext.getSoapAction() != null ? messageContext.getSoapAction() : "null"));
        log.debug("WSA-Action: "
                + (messageContext.getWSAAction() != null ? messageContext.getWSAAction() : "null"));
        String[] cids = messageContext.getAttachmentMap().getAllContentIDs();
        if (cids != null && cids.length > 0) {
            for (int i = 0; i < cids.length; i++) {
                log.debug("Attachment : " + cids[i]);
            }
        }
        log.debug("Body : \n" + messageContext.getEnvelope());
    }
}

From source file:org.apache.synapse.handler.util.HandlerUtil.java

public static boolean mediateInMessage(Log log, MessageContext messageContext,
        org.apache.synapse.MessageContext synCtx) throws AxisFault {

    AxisService service = messageContext.getAxisService();
    if (service != null) {
        Parameter inMediationParam = service.getParameter(HandlerConstants.IN_SEQUENCE_PARAM_NAME);
        if (inMediationParam != null && inMediationParam.getValue() != null) {
            if (inMediationParam.getValue() instanceof Mediator) {
                Mediator inMessageSequence = (Mediator) inMediationParam.getValue();
                return inMessageSequence.mediate(synCtx);
            } else if (inMediationParam.getValue() instanceof String) {
                Mediator inMessageSequence = synCtx.getConfiguration()
                        .getSequence((String) inMediationParam.getValue());
                return inMessageSequence.mediate(synCtx);
            } else {
                if (log.isDebugEnabled()) {
                    log.debug("The provided in message mediation " + "sequence is not a proper mediator");
                }/*from  w  w  w. ja va 2  s.  c  o m*/
            }
        } else {
            if (log.isDebugEnabled()) {
                log.debug("Couldn't find the incoming mediation for the service " + service.getName());
            }
        }
    } else {
        String message = "Couldn't find the Service for the associated message with id "
                + messageContext.getMessageID();
        log.error(message);
        throw new AxisFault(message);
    }
    return true;
}

From source file:org.apache.synapse.handler.util.HandlerUtil.java

public static boolean mediateOutMessage(Log log, MessageContext messageContext,
        org.apache.synapse.MessageContext synCtx) throws AxisFault {

    AxisService service = messageContext.getAxisService();
    if (service != null) {
        Parameter inMediationParam = service.getParameter(HandlerConstants.OUT_SEQUENCE_PARAM_NAME);
        if (inMediationParam != null && inMediationParam.getValue() != null) {
            if (inMediationParam.getValue() instanceof Mediator) {
                Mediator inMessageSequence = (Mediator) inMediationParam.getValue();
                return inMessageSequence.mediate(synCtx);
            } else if (inMediationParam.getValue() instanceof String) {
                Mediator inMessageSequence = synCtx.getConfiguration()
                        .getSequence((String) inMediationParam.getValue());
                return inMessageSequence.mediate(synCtx);
            } else {
                if (log.isDebugEnabled()) {
                    log.debug("The provided out message mediation " + "sequence is not a proper mediator");
                }//from  w w  w . j ava 2  s.c  o m
            }
        } else {
            if (log.isDebugEnabled()) {
                log.debug("Couldn't find the outgoing mediation for the service " + service.getName());
            }
        }
    } else {
        String message = "Couldn't find the Service for the associated message with id "
                + messageContext.getMessageID();
        log.error(message);
        throw new AxisFault(message);
    }
    return true;
}

From source file:org.apache.synapse.transport.http.conn.LoggingUtils.java

public static NHttpClientEventHandler decorate(NHttpClientEventHandler handler) {
    Log log = LogFactory.getLog(handler.getClass());
    if (log.isDebugEnabled()) {
        handler = new LoggingNHttpClientHandler(log, handler);
    }/*from ww  w .  j a  v a  2s. co  m*/
    return handler;
}

From source file:org.apache.synapse.transport.http.conn.LoggingUtils.java

public static NHttpServerEventHandler decorate(NHttpServerEventHandler handler) {
    Log log = LogFactory.getLog(handler.getClass());
    if (log.isDebugEnabled()) {
        handler = new LoggingNHttpServiceHandler(log, handler);
    }/*from   ww  w . ja  v a  2s  .  c om*/
    return handler;
}

From source file:org.apache.synapse.transport.nhttp.LoggingUtils.java

public static IOSession decorate(IOSession session, final String id) {
    Log log = LogFactory.getLog(session.getClass());
    if (log.isDebugEnabled()) {
        session = new LoggingIOSession(log, session, id);
    }//from  w ww  .  j a v  a 2s  . c o m
    return session;
}