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.qedeq.base.trace.Trace.java

/**
 * Trace parameter.//from  w w  w. j  a  v  a  2  s. c  o  m
 *
 * @param   tracingClass    Class that wants to make a trace entry.
 * @param   method          Method of that class.
 * @param   param           Parameter to trace.
 * @param   value           Value of parameter.
 */
public static void param(final Class tracingClass, final String method, final String param,
        final Object value) {
    if (traceOn) {
        final Log log = LogFactory.getFactory().getInstance(tracingClass);
        if (log.isDebugEnabled()) {
            log.debug("." + method + " " + param + "=" + value);
        }
    }
}

From source file:org.qedeq.base.trace.Trace.java

/**
 * Trace parameter.//  ww w  .  j av  a 2  s. c o m
 *
 * @param   tracingClass    Class that wants to make a trace entry.
 * @param   tracingObject   Instance that wants to make a trace entry.
 * @param   method          Method of that object.
 * @param   param           Parameter to trace.
 * @param   value           Value of parameter.
 */
public static void param(final Class tracingClass, final Object tracingObject, final String method,
        final String param, final int value) {
    if (traceOn) {
        final Log log = LogFactory.getFactory().getInstance(tracingClass);
        if (log.isDebugEnabled()) {
            log.debug("." + method + " " + param + "=" + value);
        }
    }
}

From source file:org.qedeq.base.trace.Trace.java

/**
 * Trace parameter./* w  ww .  j a v a  2 s .com*/
 *
 * @param   tracingClass    Class that wants to make a trace entry.
 * @param   method          Method of that class.
 * @param   param           Parameter to trace.
 * @param   value           Value of parameter.
 */
public static void param(final Class tracingClass, final String method, final String param, final int value) {
    if (traceOn) {
        final Log log = LogFactory.getFactory().getInstance(tracingClass);
        if (log.isDebugEnabled()) {
            log.debug("." + method + " " + param + "=" + value);
        }
    }
}

From source file:org.qedeq.base.trace.Trace.java

/**
 * Trace parameter./* w w  w .  j a va  2  s  . c  om*/
 *
 * @param   tracingClass    Class that wants to make a trace entry.
 * @param   tracingObject   Instance that wants to make a trace entry.
 * @param   method          Method of that object.
 * @param   param           Parameter to trace.
 * @param   value           Value of parameter.
 */
public static void param(final Class tracingClass, final Object tracingObject, final String method,
        final String param, final boolean value) {
    if (traceOn) {
        final Log log = LogFactory.getFactory().getInstance(tracingClass);
        if (log.isDebugEnabled()) {
            log.debug("." + method + " " + param + "=" + value);
        }
    }
}

From source file:org.qedeq.base.trace.Trace.java

/**
 * Trace parameter./*w  ww.  j  av a 2s.c  o  m*/
 *
 * @param   tracingClass    Class that wants to make a trace entry.
 * @param   method          Method of that class.
 * @param   param           Parameter to trace.
 * @param   value           Value of parameter.
 */
public static void param(final Class tracingClass, final String method, final String param,
        final boolean value) {
    if (traceOn) {
        final Log log = LogFactory.getFactory().getInstance(tracingClass);
        if (log.isDebugEnabled()) {
            log.debug("." + method + " " + param + "=" + value);
        }
    }
}

From source file:org.qedeq.base.trace.Trace.java

/**
 * Write stacktrace into trace if debug level is on.
 *
 * @param   tracingClass    Class that wants to make a trace entry.
 * @param   tracingObject   Instance that wants to make a trace entry.
 * @param   method          Method of that object.
 *//*  w  ww.  j a v a 2s  .  co m*/
public static void traceStack(final Class tracingClass, final Object tracingObject, final String method) {
    if (traceOn) {
        final Log log = LogFactory.getFactory().getInstance(tracingClass);
        if (!log.isDebugEnabled()) {
            return;
        }
        try {
            throw new Exception("Stacktrace");
        } catch (Exception e) {
            log.debug("." + method + " " + e, e);
        }
    }
}

From source file:org.qedeq.base.trace.Trace.java

/**
 * Write stacktrace into trace if debug level is on.
 *
 * @param   tracingClass    Class that wants to make a trace entry.
 * @param   method          Method of that class.
 *///from w w  w.  j  a  v  a 2s. c om
public static final void traceStack(final Class tracingClass, final String method) {
    if (traceOn) {
        final Log log = LogFactory.getFactory().getInstance(tracingClass);
        if (!log.isDebugEnabled()) {
            return;
        }
        try {
            throw new Exception("Stacktrace");
        } catch (Exception e) {
            log.debug("." + method + " " + e, e);
        }
    }
}

From source file:org.quartz.impl.jdbcjobstore.DBSemaphore.java

/**
 * Grants a lock on the identified resource to the calling thread (blocking
 * until it is available).//  w  ww  . ja  v a 2 s .co  m
 * 
 * @return true if the lock was obtained.
 */
public boolean obtainLock(Connection conn, String lockName) throws LockException {

    lockName = lockName.intern();

    Log log = getLog();

    if (log.isDebugEnabled()) {
        log.debug("Lock '" + lockName + "' is desired by: " + Thread.currentThread().getName());
    }
    if (!isLockOwner(conn, lockName)) {

        executeSQL(conn, lockName, expandedSQL);

        if (log.isDebugEnabled()) {
            log.debug("Lock '" + lockName + "' given to: " + Thread.currentThread().getName());
        }
        getThreadLocks().add(lockName);
        //getThreadLocksObtainer().put(lockName, new
        // Exception("Obtainer..."));
    } else if (log.isDebugEnabled()) {
        log.debug("Lock '" + lockName + "' Is already owned by: " + Thread.currentThread().getName());
    }

    return true;
}

From source file:org.quartz.impl.jdbcjobstore.JTANonClusteredSemaphore.java

/**
 * Grants a lock on the identified resource to the calling thread (blocking
 * until it is available).// ww  w  . j a v a 2  s  . c  o  m
 * 
 * @return true if the lock was obtained.
 */
public synchronized boolean obtainLock(Connection conn, String lockName) throws LockException {

    lockName = lockName.intern();

    Log log = getLog();

    if (log.isDebugEnabled()) {
        log.debug("Lock '" + lockName + "' is desired by: " + Thread.currentThread().getName());
    }

    if (!isLockOwner(conn, lockName)) {
        if (log.isDebugEnabled()) {
            log.debug("Lock '" + lockName + "' is being obtained: " + Thread.currentThread().getName());
        }

        while (locks.contains(lockName)) {
            try {
                this.wait();
            } catch (InterruptedException ie) {
                if (log.isDebugEnabled()) {
                    log.debug(
                            "Lock '" + lockName + "' was not obtained by: " + Thread.currentThread().getName());
                }
            }
        }

        // If we are in a transaction, register a callback to actually release
        // the lock when the transaction completes
        Transaction t = getTransaction();
        if (t != null) {
            try {
                t.registerSynchronization(new SemaphoreSynchronization(lockName));
            } catch (Exception e) {
                throw new LockException("Failed to register semaphore with Transaction.", e);
            }
        }

        if (log.isDebugEnabled()) {
            log.debug("Lock '" + lockName + "' given to: " + Thread.currentThread().getName());
        }

        getThreadLocks().add(lockName);
        locks.add(lockName);
    } else if (log.isDebugEnabled()) {
        log.debug("Lock '" + lockName + "' already owned by: " + Thread.currentThread().getName()
                + " -- but not owner!", new Exception("stack-trace of wrongful returner"));
    }

    return true;
}

From source file:org.quartz.impl.jdbcjobstore.SimpleSemaphore.java

/**
 * Grants a lock on the identified resource to the calling thread (blocking
 * until it is available)./*w ww  . j  a  va 2 s.  c  om*/
 * 
 * @return true if the lock was obtained.
 */
public synchronized boolean obtainLock(Connection conn, String lockName) {

    lockName = lockName.intern();

    Log log = getLog();

    if (log.isDebugEnabled()) {
        log.debug("Lock '" + lockName + "' is desired by: " + Thread.currentThread().getName());
    }

    if (!isLockOwner(conn, lockName)) {
        if (log.isDebugEnabled()) {
            log.debug("Lock '" + lockName + "' is being obtained: " + Thread.currentThread().getName());
        }
        while (locks.contains(lockName)) {
            try {
                this.wait();
            } catch (InterruptedException ie) {
                if (log.isDebugEnabled()) {
                    log.debug(
                            "Lock '" + lockName + "' was not obtained by: " + Thread.currentThread().getName());
                }
            }
        }

        if (log.isDebugEnabled()) {
            log.debug("Lock '" + lockName + "' given to: " + Thread.currentThread().getName());
        }
        getThreadLocks().add(lockName);
        locks.add(lockName);
    } else if (log.isDebugEnabled()) {
        log.debug("Lock '" + lockName + "' already owned by: " + Thread.currentThread().getName()
                + " -- but not owner!", new Exception("stack-trace of wrongful returner"));
    }

    return true;
}