Update to add a trace() level to the Log interface.
Currently uses debug() in Log4J and LogKit PR: Obtained from: Submitted by: Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/logging/trunk@138850 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//logging/src/java/org/apache/commons/logging/Attic/Jdk14Logger.java,v 1.4 2002/01/30 03:56:26 craigmcc Exp $
|
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//logging/src/java/org/apache/commons/logging/Attic/Jdk14Logger.java,v 1.5 2002/01/31 00:14:31 sanders Exp $
|
||||||
* $Revision: 1.4 $
|
* $Revision: 1.5 $
|
||||||
* $Date: 2002/01/30 03:56:26 $
|
* $Date: 2002/01/31 00:14:31 $
|
||||||
*
|
*
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*
|
*
|
||||||
@@ -72,9 +72,10 @@ import java.util.logging.Logger;
|
|||||||
* interfaces that wraps the standard JDK logging mechanisms that were
|
* interfaces that wraps the standard JDK logging mechanisms that were
|
||||||
* introduced in the Merlin release (JDK 1.4).</p>
|
* introduced in the Merlin release (JDK 1.4).</p>
|
||||||
*
|
*
|
||||||
|
* @author <a href="mailto:sanders@apache.org">Scott Sanders</a>
|
||||||
* @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
|
* @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
|
||||||
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
|
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
|
||||||
* @version $Revision: 1.4 $ $Date: 2002/01/30 03:56:26 $
|
* @version $Revision: 1.5 $ $Date: 2002/01/31 00:14:31 $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public final class Jdk14Logger implements Log {
|
public final class Jdk14Logger implements Log {
|
||||||
@@ -239,6 +240,16 @@ public final class Jdk14Logger implements Log {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is tace logging currently enabled?
|
||||||
|
*/
|
||||||
|
public boolean isTraceEnabled() {
|
||||||
|
|
||||||
|
return (logger.isLoggable(Level.FINEST));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is warning logging currently enabled?
|
* Is warning logging currently enabled?
|
||||||
*/
|
*/
|
||||||
@@ -249,6 +260,26 @@ public final class Jdk14Logger implements Log {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Log a message with trace log level.
|
||||||
|
*/
|
||||||
|
public void trace(Object message) {
|
||||||
|
|
||||||
|
logger.log(Level.FINEST, message.toString());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Log a message and exception with trace log level.
|
||||||
|
*/
|
||||||
|
public void trace(Object message, Throwable exception) {
|
||||||
|
|
||||||
|
logger.log(Level.FINEST, message.toString(), exception);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Log a message with warn log level.
|
* Log a message with warn log level.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//logging/src/java/org/apache/commons/logging/Log.java,v 1.11 2002/01/23 20:14:30 rdonkin Exp $
|
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//logging/src/java/org/apache/commons/logging/Log.java,v 1.12 2002/01/31 00:14:31 sanders Exp $
|
||||||
* $Revision: 1.11 $
|
* $Revision: 1.12 $
|
||||||
* $Date: 2002/01/23 20:14:30 $
|
* $Date: 2002/01/31 00:14:31 $
|
||||||
*
|
*
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*
|
*
|
||||||
@@ -68,9 +68,10 @@ package org.apache.commons.logging;
|
|||||||
* this interface must have a constructor that takes a single String
|
* this interface must have a constructor that takes a single String
|
||||||
* parameter representing the "name" of this Log.</p>
|
* parameter representing the "name" of this Log.</p>
|
||||||
*
|
*
|
||||||
* <p> The five logging levels used by <code>Log</code> are (in order):
|
* <p> The six logging levels used by <code>Log</code> are (in order):
|
||||||
* <ol>
|
* <ol>
|
||||||
* <li>debug (the least serious)</li>
|
* <li>trace (the least serious)</li>
|
||||||
|
* <li>debug</li>
|
||||||
* <li>info</li>
|
* <li>info</li>
|
||||||
* <li>warn</li>
|
* <li>warn</li>
|
||||||
* <li>error</li>
|
* <li>error</li>
|
||||||
@@ -99,8 +100,9 @@ package org.apache.commons.logging;
|
|||||||
* external to the Logging APIs, through whatever mechanism is supported by
|
* external to the Logging APIs, through whatever mechanism is supported by
|
||||||
* that system.</p>
|
* that system.</p>
|
||||||
*
|
*
|
||||||
|
* @author <a href="mailto:sanders@apache.org">Scott Sanders</a>
|
||||||
* @author Rod Waldhoff
|
* @author Rod Waldhoff
|
||||||
* @version $Id: Log.java,v 1.11 2002/01/23 20:14:30 rdonkin Exp $
|
* @version $Id: Log.java,v 1.12 2002/01/31 00:14:31 sanders Exp $
|
||||||
*/
|
*/
|
||||||
public interface Log {
|
public interface Log {
|
||||||
|
|
||||||
@@ -148,6 +150,16 @@ public interface Log {
|
|||||||
public boolean isInfoEnabled();
|
public boolean isInfoEnabled();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p> Is trace logging currently enabled? </p>
|
||||||
|
*
|
||||||
|
* <p> Call this method to prevent having to perform expensive operations
|
||||||
|
* (for example, <code>String</code> concatination)
|
||||||
|
* when the log level is more than trace. </p>
|
||||||
|
*/
|
||||||
|
public boolean isTraceEnabled();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p> Is warning logging currently enabled? </p>
|
* <p> Is warning logging currently enabled? </p>
|
||||||
*
|
*
|
||||||
@@ -161,6 +173,23 @@ public interface Log {
|
|||||||
// -------------------------------------------------------- Logging Methods
|
// -------------------------------------------------------- Logging Methods
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p> Log a message with trace log level </p>
|
||||||
|
*
|
||||||
|
* @param message log this message
|
||||||
|
*/
|
||||||
|
public void trace(Object message);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p> Log an error with trace log level </p>
|
||||||
|
*
|
||||||
|
* @param message log this message
|
||||||
|
* @param t log this cause
|
||||||
|
*/
|
||||||
|
public void trace(Object message, Throwable t);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p> Log a message with debug log level </p>
|
* <p> Log a message with debug log level </p>
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//logging/src/java/org/apache/commons/logging/Attic/Log4JCategoryLog.java,v 1.9 2002/01/24 18:29:36 rdonkin Exp $
|
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//logging/src/java/org/apache/commons/logging/Attic/Log4JCategoryLog.java,v 1.10 2002/01/31 00:14:31 sanders Exp $
|
||||||
* $Revision: 1.9 $
|
* $Revision: 1.10 $
|
||||||
* $Date: 2002/01/24 18:29:36 $
|
* $Date: 2002/01/31 00:14:31 $
|
||||||
*
|
*
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*
|
*
|
||||||
@@ -71,10 +71,10 @@ import org.apache.log4j.Priority;
|
|||||||
* Category instances should be done in the usual manner, as outlined in
|
* Category instances should be done in the usual manner, as outlined in
|
||||||
* the Log4J documentation.</p>
|
* the Log4J documentation.</p>
|
||||||
*
|
*
|
||||||
|
* @author <a href="mailto:sanders@apache.org">Scott Sanders</a>
|
||||||
* @author Rod Waldhoff
|
* @author Rod Waldhoff
|
||||||
* @author Robert Burrell Donkin
|
* @author Robert Burrell Donkin
|
||||||
*
|
* @version $Id: Log4JCategoryLog.java,v 1.10 2002/01/31 00:14:31 sanders Exp $
|
||||||
* @version $Id: Log4JCategoryLog.java,v 1.9 2002/01/24 18:29:36 rdonkin Exp $
|
|
||||||
*/
|
*/
|
||||||
public final class Log4JCategoryLog implements Log {
|
public final class Log4JCategoryLog implements Log {
|
||||||
|
|
||||||
@@ -100,6 +100,24 @@ public final class Log4JCategoryLog implements Log {
|
|||||||
// ---------------------------------------------------------- Implmentation
|
// ---------------------------------------------------------- Implmentation
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Log a message to the Log4j Category with <code>TRACE</code> priority.
|
||||||
|
* Currently logs to <code>DEBUG</code> level in Log4J.
|
||||||
|
*/
|
||||||
|
public void trace(Object message) {
|
||||||
|
category.debug(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Log an error to the Log4j Category with <code>TRACE</code> priority.
|
||||||
|
* Currently logs to <code>DEBUG</code> level in Log4J.
|
||||||
|
*/
|
||||||
|
public void trace(Object message, Throwable t) {
|
||||||
|
category.debug(message,t);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Log a message to the Log4j Category with <code>DEBUG</code> priority.
|
* Log a message to the Log4j Category with <code>DEBUG</code> priority.
|
||||||
*/
|
*/
|
||||||
@@ -212,6 +230,14 @@ public final class Log4JCategoryLog implements Log {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check whether the Log4j Category used is enabled for <code>TRACE</code> priority.
|
||||||
|
* For Log4J, this returns the value of <code>isDebugEnabled()</code>
|
||||||
|
*/
|
||||||
|
public boolean isTraceEnabled() {
|
||||||
|
return category.isDebugEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether the Log4j Category used is enabled for <code>WARN</code> priority.
|
* Check whether the Log4j Category used is enabled for <code>WARN</code> priority.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//logging/src/java/org/apache/commons/logging/Attic/LogKitLogger.java,v 1.3 2002/01/24 19:02:35 rdonkin Exp $
|
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//logging/src/java/org/apache/commons/logging/Attic/LogKitLogger.java,v 1.4 2002/01/31 00:14:31 sanders Exp $
|
||||||
* $Revision: 1.3 $
|
* $Revision: 1.4 $
|
||||||
* $Date: 2002/01/24 19:02:35 $
|
* $Date: 2002/01/31 00:14:31 $
|
||||||
*
|
*
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*
|
*
|
||||||
@@ -74,9 +74,9 @@ import org.apache.log.Hierarchy;
|
|||||||
* Therefore, this implementation converts object messages into strings
|
* Therefore, this implementation converts object messages into strings
|
||||||
* by called their <code>toString()</code> method before logging them.</p>
|
* by called their <code>toString()</code> method before logging them.</p>
|
||||||
*
|
*
|
||||||
* @author Robert Burrell Donkin
|
* @author <a href="mailto:sanders@apache.org">Scott Sanders</a>
|
||||||
*
|
* @author Robert Burrell Donkin *
|
||||||
* @version $Id: LogKitLogger.java,v 1.3 2002/01/24 19:02:35 rdonkin Exp $
|
* @version $Id: LogKitLogger.java,v 1.4 2002/01/31 00:14:31 sanders Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public final class LogKitLogger implements Log {
|
public final class LogKitLogger implements Log {
|
||||||
@@ -106,6 +106,22 @@ public final class LogKitLogger implements Log {
|
|||||||
// ----------------------------------------------------- Log Implementation
|
// ----------------------------------------------------- Log Implementation
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Log message to <code>LogKit</code> logger with <code>DEBUG</code> priority.
|
||||||
|
*/
|
||||||
|
public void trace(Object message) {
|
||||||
|
debug(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Log error to <code>LogKit</code> logger with <code>DEBUG</code> priority.
|
||||||
|
*/
|
||||||
|
public void trace(Object message, Throwable t) {
|
||||||
|
debug(message, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Log message to <code>LogKit</code> logger with <code>DEBUG</code> priority.
|
* Log message to <code>LogKit</code> logger with <code>DEBUG</code> priority.
|
||||||
*/
|
*/
|
||||||
@@ -238,6 +254,14 @@ public final class LogKitLogger implements Log {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check whether the <code>LogKit</code> logger will log messages of priority <code>DEBUG</code>.
|
||||||
|
*/
|
||||||
|
public boolean isTraceEnabled() {
|
||||||
|
return logger.isDebugEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether the <code>LogKit</code> logger will log messages of priority <code>WARN</code>.
|
* Check whether the <code>LogKit</code> logger will log messages of priority <code>WARN</code>.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//logging/src/java/org/apache/commons/logging/Attic/NoOpLog.java,v 1.8 2002/01/17 01:47:49 craigmcc Exp $
|
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//logging/src/java/org/apache/commons/logging/Attic/NoOpLog.java,v 1.9 2002/01/31 00:14:31 sanders Exp $
|
||||||
* $Revision: 1.8 $
|
* $Revision: 1.9 $
|
||||||
* $Date: 2002/01/17 01:47:49 $
|
* $Date: 2002/01/31 00:14:31 $
|
||||||
*
|
*
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*
|
*
|
||||||
@@ -66,8 +66,9 @@ package org.apache.commons.logging;
|
|||||||
* <p>Default implementation of Log that throws away all messages. No
|
* <p>Default implementation of Log that throws away all messages. No
|
||||||
* configurable system properties are supported.</p>
|
* configurable system properties are supported.</p>
|
||||||
*
|
*
|
||||||
|
* @author <a href="mailto:sanders@apache.org">Scott Sanders</a>
|
||||||
* @author Rod Waldhoff
|
* @author Rod Waldhoff
|
||||||
* @version $Id: NoOpLog.java,v 1.8 2002/01/17 01:47:49 craigmcc Exp $
|
* @version $Id: NoOpLog.java,v 1.9 2002/01/31 00:14:31 sanders Exp $
|
||||||
*/
|
*/
|
||||||
public final class NoOpLog implements Log {
|
public final class NoOpLog implements Log {
|
||||||
|
|
||||||
@@ -76,6 +77,10 @@ public final class NoOpLog implements Log {
|
|||||||
/** Base constructor */
|
/** Base constructor */
|
||||||
public NoOpLog(String name) { }
|
public NoOpLog(String name) { }
|
||||||
/** Do nothing */
|
/** Do nothing */
|
||||||
|
public void trace(Object message) { }
|
||||||
|
/** Do nothing */
|
||||||
|
public void trace(Object message, Throwable t) { }
|
||||||
|
/** Do nothing */
|
||||||
public void debug(Object message) { }
|
public void debug(Object message) { }
|
||||||
/** Do nothing */
|
/** Do nothing */
|
||||||
public void debug(Object message, Throwable t) { }
|
public void debug(Object message, Throwable t) { }
|
||||||
@@ -124,6 +129,13 @@ public final class NoOpLog implements Log {
|
|||||||
*/
|
*/
|
||||||
public final boolean isInfoEnabled() { return false; }
|
public final boolean isInfoEnabled() { return false; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Trace is never enabled.
|
||||||
|
*
|
||||||
|
* @return false
|
||||||
|
*/
|
||||||
|
public final boolean isTraceEnabled() { return false; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Warning is never enabled.
|
* Warning is never enabled.
|
||||||
*
|
*
|
||||||
@@ -131,5 +143,4 @@ public final class NoOpLog implements Log {
|
|||||||
*/
|
*/
|
||||||
public final boolean isWarnEnabled() { return false; }
|
public final boolean isWarnEnabled() { return false; }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//logging/src/java/org/apache/commons/logging/Attic/SimpleLog.java,v 1.11 2002/01/25 18:41:48 sanders Exp $
|
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//logging/src/java/org/apache/commons/logging/Attic/SimpleLog.java,v 1.12 2002/01/31 00:14:31 sanders Exp $
|
||||||
* $Revision: 1.11 $
|
* $Revision: 1.12 $
|
||||||
* $Date: 2002/01/25 18:41:48 $
|
* $Date: 2002/01/31 00:14:31 $
|
||||||
*
|
*
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*
|
*
|
||||||
@@ -76,11 +76,11 @@ import java.util.Date;
|
|||||||
* <ul>
|
* <ul>
|
||||||
* <li><code>org.apache.commons.logging.simplelog.defaultlog</code> -
|
* <li><code>org.apache.commons.logging.simplelog.defaultlog</code> -
|
||||||
* Default logging detail level for all instances of SimpleLog.
|
* Default logging detail level for all instances of SimpleLog.
|
||||||
* Must be one of ("debug", "info", "warn", "error", or "fatal").
|
* Must be one of ("trace", "debug", "info", "warn", "error", or "fatal").
|
||||||
* If not specified, defaults to "error". </li>
|
* If not specified, defaults to "error". </li>
|
||||||
* <li><code>org.apache.commons.logging.simplelog.log.xxxxx</code> -
|
* <li><code>org.apache.commons.logging.simplelog.log.xxxxx</code> -
|
||||||
* Logging detail level for a SimpleLog instance named "xxxxx".
|
* Logging detail level for a SimpleLog instance named "xxxxx".
|
||||||
* Must be one of ("debug", "info", "warn", "error", or "fatal").
|
* Must be one of ("trace", "debug", "info", "warn", "error", or "fatal").
|
||||||
* If not specified, the default logging detail level is used.</li>
|
* If not specified, the default logging detail level is used.</li>
|
||||||
* <li><code>org.apache.commons.logging.simplelog.showlogname</code> -
|
* <li><code>org.apache.commons.logging.simplelog.showlogname</code> -
|
||||||
* Set to <code>true</code> if you want the Log instance name to be
|
* Set to <code>true</code> if you want the Log instance name to be
|
||||||
@@ -95,10 +95,11 @@ import java.util.Date;
|
|||||||
* <code>"simplelog.properties"</code>, and includes any matching definitions
|
* <code>"simplelog.properties"</code>, and includes any matching definitions
|
||||||
* from this resource (if it exists).</p>
|
* from this resource (if it exists).</p>
|
||||||
*
|
*
|
||||||
|
* @author <a href="mailto:sanders@apache.org">Scott Sanders</a>
|
||||||
* @author Rod Waldhoff
|
* @author Rod Waldhoff
|
||||||
* @author Robert Burrell Donkin
|
* @author Robert Burrell Donkin
|
||||||
*
|
*
|
||||||
* @version $Id: SimpleLog.java,v 1.11 2002/01/25 18:41:48 sanders Exp $
|
* @version $Id: SimpleLog.java,v 1.12 2002/01/31 00:14:31 sanders Exp $
|
||||||
*/
|
*/
|
||||||
public class SimpleLog implements Log {
|
public class SimpleLog implements Log {
|
||||||
|
|
||||||
@@ -121,19 +122,21 @@ public class SimpleLog implements Log {
|
|||||||
// ---------------------------------------------------- Log Level Constants
|
// ---------------------------------------------------- Log Level Constants
|
||||||
|
|
||||||
|
|
||||||
|
/** "Trace" level logging. */
|
||||||
|
public static final int LOG_LEVEL_TRACE = 1;
|
||||||
/** "Debug" level logging. */
|
/** "Debug" level logging. */
|
||||||
public static final int LOG_LEVEL_DEBUG = 1;
|
public static final int LOG_LEVEL_DEBUG = 2;
|
||||||
/** "Info" level logging. */
|
/** "Info" level logging. */
|
||||||
public static final int LOG_LEVEL_INFO = 2;
|
public static final int LOG_LEVEL_INFO = 3;
|
||||||
/** "Warn" level logging. */
|
/** "Warn" level logging. */
|
||||||
public static final int LOG_LEVEL_WARN = 3;
|
public static final int LOG_LEVEL_WARN = 4;
|
||||||
/** "Error" level logging. */
|
/** "Error" level logging. */
|
||||||
public static final int LOG_LEVEL_ERROR = 4;
|
public static final int LOG_LEVEL_ERROR = 5;
|
||||||
/** "Fatal" level logging. */
|
/** "Fatal" level logging. */
|
||||||
public static final int LOG_LEVEL_FATAL = 5;
|
public static final int LOG_LEVEL_FATAL = 6;
|
||||||
|
|
||||||
/** Enable all logging levels */
|
/** Enable all logging levels */
|
||||||
public static final int LOG_LEVEL_ALL = (LOG_LEVEL_DEBUG - 1);
|
public static final int LOG_LEVEL_ALL = (LOG_LEVEL_TRACE - 1);
|
||||||
|
|
||||||
/** Enable no logging levels */
|
/** Enable no logging levels */
|
||||||
public static final int LOG_LEVEL_OFF = (LOG_LEVEL_FATAL + 1);
|
public static final int LOG_LEVEL_OFF = (LOG_LEVEL_FATAL + 1);
|
||||||
@@ -217,6 +220,8 @@ public class SimpleLog implements Log {
|
|||||||
|
|
||||||
if("all".equalsIgnoreCase(lvl)) {
|
if("all".equalsIgnoreCase(lvl)) {
|
||||||
setLevel(SimpleLog.LOG_LEVEL_ALL);
|
setLevel(SimpleLog.LOG_LEVEL_ALL);
|
||||||
|
} else if("trace".equalsIgnoreCase(lvl)) {
|
||||||
|
setLevel(SimpleLog.LOG_LEVEL_TRACE);
|
||||||
} else if("debug".equalsIgnoreCase(lvl)) {
|
} else if("debug".equalsIgnoreCase(lvl)) {
|
||||||
setLevel(SimpleLog.LOG_LEVEL_DEBUG);
|
setLevel(SimpleLog.LOG_LEVEL_DEBUG);
|
||||||
} else if("info".equalsIgnoreCase(lvl)) {
|
} else if("info".equalsIgnoreCase(lvl)) {
|
||||||
@@ -276,6 +281,7 @@ public class SimpleLog implements Log {
|
|||||||
|
|
||||||
// append a readable representation of the log leve
|
// append a readable representation of the log leve
|
||||||
switch(type) {
|
switch(type) {
|
||||||
|
case SimpleLog.LOG_LEVEL_TRACE: buf.append("[TRACE] "); break;
|
||||||
case SimpleLog.LOG_LEVEL_DEBUG: buf.append("[DEBUG] "); break;
|
case SimpleLog.LOG_LEVEL_DEBUG: buf.append("[DEBUG] "); break;
|
||||||
case SimpleLog.LOG_LEVEL_INFO: buf.append("[INFO] "); break;
|
case SimpleLog.LOG_LEVEL_INFO: buf.append("[INFO] "); break;
|
||||||
case SimpleLog.LOG_LEVEL_WARN: buf.append("[WARN] "); break;
|
case SimpleLog.LOG_LEVEL_WARN: buf.append("[WARN] "); break;
|
||||||
@@ -341,6 +347,28 @@ public class SimpleLog implements Log {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p> Log a message with debug log level.</p>
|
||||||
|
*/
|
||||||
|
public final void trace(Object message) {
|
||||||
|
|
||||||
|
if (isLevelEnabled(SimpleLog.LOG_LEVEL_TRACE)) {
|
||||||
|
log(SimpleLog.LOG_LEVEL_TRACE, message, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p> Log an error with debug log level.</p>
|
||||||
|
*/
|
||||||
|
public final void trace(Object message, Throwable t) {
|
||||||
|
|
||||||
|
if (isLevelEnabled(SimpleLog.LOG_LEVEL_TRACE)) {
|
||||||
|
log(SimpleLog.LOG_LEVEL_TRACE, message, t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p> Log a message with info log level.</p>
|
* <p> Log a message with info log level.</p>
|
||||||
*/
|
*/
|
||||||
@@ -481,6 +509,19 @@ public class SimpleLog implements Log {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p> Are trace messages currently enabled? </p>
|
||||||
|
*
|
||||||
|
* <p> This allows expensive operations such as <code>String</code>
|
||||||
|
* concatenation to be avoided when the message will be ignored by the
|
||||||
|
* logger. </p>
|
||||||
|
*/
|
||||||
|
public final boolean isTraceEnabled() {
|
||||||
|
|
||||||
|
return isLevelEnabled(SimpleLog.LOG_LEVEL_TRACE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p> Are warn messages currently enabled? </p>
|
* <p> Are warn messages currently enabled? </p>
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user