You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by co...@apache.org on 2001/02/06 07:47:38 UTC
cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/loggers LogEvents.java
costin 01/02/05 22:47:38
Modified: src/share/org/apache/tomcat/modules/loggers LogEvents.java
Log:
First use of registerHooks: LogEvents will add itself to the
server only if debug>5 on ContextManager.
( LogEvents is very usefull in seeing what happens inside the server,
I recommend you use it for debugging )
Revision Changes Path
1.2 +17 -0 jakarta-tomcat/src/share/org/apache/tomcat/modules/loggers/LogEvents.java
Index: LogEvents.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/loggers/LogEvents.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- LogEvents.java 2001/01/01 01:58:38 1.1
+++ LogEvents.java 2001/02/06 06:47:38 1.2
@@ -61,6 +61,7 @@
import org.apache.tomcat.core.*;
import org.apache.tomcat.util.*;
+import org.apache.tomcat.util.hooks.*;
import java.io.*;
import java.net.*;
import java.util.*;
@@ -70,10 +71,25 @@
* output )
*/
public class LogEvents extends BaseInterceptor {
+ boolean enabled=false;
public LogEvents() {
}
+ public void setEnabled( boolean b ) {
+ enabled=b;
+ }
+
+ public int registerHooks( Hooks hooks, ContextManager cm, Context ctx ) {
+ if( enabled || cm.getDebug() > 5 ) {
+ enabled=true;
+ log( "Adding LogEvents, cm.debug=" + cm.getDebug() + " "
+ + enabled);
+ hooks.addModule( this );
+ }
+ return DECLINED;
+ }
+
// -------------------- Request notifications --------------------
public int requestMap(Request request ) {
log( "requestMap " + request);
@@ -209,6 +225,7 @@
BaseInterceptor i )
throws TomcatException
{
+ if( ! enabled ) return;
if( ctx==null)
log( "addInterceptor " + i );
else {