remm 2002/08/28 05:03:16
Modified: catalina/src/share/org/apache/catalina/core
StandardContext.java
Log:
- Add swallowOutput flag, to allow disabling/enabling sys.out and sys.err
redirection to the logger.
- Redirection is disabled by default.
Revision Changes Path
1.111 +50 -12
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardContext.java
Index: StandardContext.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardContext.java,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -r1.110 -r1.111
--- StandardContext.java 26 Aug 2002 12:15:59 -0000 1.110
+++ StandardContext.java 28 Aug 2002 12:03:15 -0000 1.111
@@ -419,6 +419,13 @@
/**
+ * Set flag to true to cause the system.out and system.err to be redirected
+ * to the logger when executing a servlet.
+ */
+ private boolean swallowOutput = false;
+
+
+ /**
* The JSP tag libraries for this web application, keyed by URI
*/
private HashMap taglibs = new HashMap();
@@ -1079,6 +1086,34 @@
/**
+ * Return the value of the swallowOutput flag.
+ */
+ public boolean getSwallowOutput() {
+
+ return (this.swallowOutput);
+
+ }
+
+
+ /**
+ * Set the value of the swallowOutput flag. If set to true, the system.out
+ * and system.err will be redirected to the logger during a servlet
+ * execution.
+ *
+ * @param swallowOuptut The new value
+ */
+ public void setSwallowOutput(boolean swallowOutput) {
+
+ boolean oldSwallowOutput = this.swallowOutput;
+ this.swallowOutput = swallowOutput;
+ support.firePropertyChange("swallowOutput",
+ new Boolean(oldSwallowOutput),
+ new Boolean(this.swallowOutput));
+
+ }
+
+
+ /**
* Return the Java class name of the Wrapper implementation used
* for servlets registered in this Context.
*/
@@ -2348,15 +2383,18 @@
}
// Normal request processing
- try {
- SystemLogHandler.startCapture();
+ if (swallowOutput) {
+ try {
+ SystemLogHandler.startCapture();
+ super.invoke(request, response);
+ } finally {
+ String log = SystemLogHandler.stopCapture();
+ if (log != null && log.length() > 0) {
+ log(log);
+ }
+ }
+ } else {
super.invoke(request, response);
- } finally {
- String log = SystemLogHandler.stopCapture();
- if (log != null && log.length() > 0) {
- log(log);
- }
-
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>