If we are not going to log the message anyway, do not waste the effort
to create a Throwable and figure out the calling class and method stuff. PR: Bugzilla #18184 Submitted by: Bruno Dumon <bruno at outerthought.org> git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/logging/trunk@138963 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/impl/Jdk14Logger.java,v 1.5 2003/03/30 23:42:36 craigmcc Exp $
|
||||
* $Revision: 1.5 $
|
||||
* $Date: 2003/03/30 23:42:36 $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//logging/src/java/org/apache/commons/logging/impl/Jdk14Logger.java,v 1.6 2003/03/31 00:27:08 craigmcc Exp $
|
||||
* $Revision: 1.6 $
|
||||
* $Date: 2003/03/31 00:27:08 $
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
@@ -77,7 +77,7 @@ import org.apache.commons.logging.Log;
|
||||
* @author <a href="mailto:sanders@apache.org">Scott Sanders</a>
|
||||
* @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
|
||||
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
|
||||
* @version $Revision: 1.5 $ $Date: 2003/03/30 23:42:36 $
|
||||
* @version $Revision: 1.6 $ $Date: 2003/03/31 00:27:08 $
|
||||
*/
|
||||
|
||||
public final class Jdk14Logger implements Log {
|
||||
@@ -110,6 +110,7 @@ public final class Jdk14Logger implements Log {
|
||||
// --------------------------------------------------------- Public Methods
|
||||
|
||||
private void log( Level level, String msg, Throwable ex ) {
|
||||
if (logger.isLoggable(level)) {
|
||||
// Hack (?) to get the stack trace.
|
||||
Throwable dummyException=new Throwable();
|
||||
StackTraceElement locations[]=dummyException.getStackTrace();
|
||||
@@ -121,13 +122,13 @@ public final class Jdk14Logger implements Log {
|
||||
cname=caller.getClassName();
|
||||
method=caller.getMethodName();
|
||||
}
|
||||
|
||||
if( ex==null ) {
|
||||
logger.logp( level, cname, method, msg );
|
||||
} else {
|
||||
logger.logp( level, cname, method, msg, ex );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Log a message with debug log level.
|
||||
|
||||
Reference in New Issue
Block a user