You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by ju...@apache.org on 2003/02/19 16:11:31 UTC
cvs commit: jakarta-slide/src/share/org/apache/slide/common SlideException.java
juergen 2003/02/19 07:11:31
Modified: src/share/org/apache/slide/common SlideException.java
Log:
performance: compute the stacktrace for tracing only if tracing is really requested. Improvements: 6% in some scenarios.
Revision Changes Path
1.8 +18 -16 jakarta-slide/src/share/org/apache/slide/common/SlideException.java
Index: SlideException.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/common/SlideException.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- SlideException.java 25 Apr 2002 21:15:10 -0000 1.7
+++ SlideException.java 19 Feb 2003 15:11:31 -0000 1.8
@@ -77,15 +77,15 @@
* @version $Revision$
*/
public class SlideException extends Exception {
-
+
private static final String CHANNEL = "org.apache.slide.common.SlideException";
private static final int DEBUG = Logger.DEBUG;
private static Logger LOGGER = Domain.getLogger();
-
-
+
+
// ----------------------------------------------------------- Constructors
-
-
+
+
/**
* SlideException with logging.
*
@@ -94,8 +94,8 @@
public SlideException(String message) {
this(message, true);
}
-
-
+
+
/**
* SlideException with or without logging.
*
@@ -107,10 +107,12 @@
if (showTrace) {
Domain.warn(message);
}
-
- StringWriter sw = new StringWriter();
- printStackTrace( new PrintWriter(sw, true) ); //autoFlush=true
- LOGGER.log( sw.toString(), CHANNEL, DEBUG );
+
+ if (LOGGER.isEnabled(CHANNEL, DEBUG)) {
+ StringWriter sw = new StringWriter();
+ printStackTrace( new PrintWriter(sw, true) ); //autoFlush=true
+ LOGGER.log( sw.toString(), CHANNEL, DEBUG );
+ }
}
-
+
}
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org