fhanik      2004/05/28 11:49:37

  Modified:    modules/cluster/src/share/org/apache/catalina/cluster/session
                        ReplicatedSession.java
                        SimpleTcpReplicationManager.java
  Log:
  using the logger instead of the old debug flag
  
  Revision  Changes    Path
  1.14      +2 -2      
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/session/ReplicatedSession.java
  
  Index: ReplicatedSession.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/session/ReplicatedSession.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- ReplicatedSession.java    27 May 2004 15:11:21 -0000      1.13
  +++ ReplicatedSession.java    28 May 2004 18:49:37 -0000      1.14
  @@ -239,7 +239,7 @@
       protected void log(String message) {
   
           if ((mManager != null) && (mManager instanceof 
SimpleTcpReplicationManager)) {
  -            ((SimpleTcpReplicationManager) mManager).log(message);
  +            ((SimpleTcpReplicationManager) mManager).log.debug("ReplicatedSession: 
" + message);
           } else {
               System.out.println("ReplicatedSession: " + message);
           }
  @@ -249,7 +249,7 @@
       protected void log(String message, Throwable x) {
   
           if ((mManager != null) && (mManager instanceof 
SimpleTcpReplicationManager)) {
  -            ((SimpleTcpReplicationManager) mManager).log(message,x);
  +            ((SimpleTcpReplicationManager) mManager).log.error("ReplicatedSession: 
" + message,x);
           } else {
               System.out.println("ReplicatedSession: " + message);
               x.printStackTrace();
  
  
  
  1.25      +16 -52    
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/session/SimpleTcpReplicationManager.java
  
  Index: SimpleTcpReplicationManager.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/session/SimpleTcpReplicationManager.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- SimpleTcpReplicationManager.java  27 May 2004 15:11:21 -0000      1.24
  +++ SimpleTcpReplicationManager.java  28 May 2004 18:49:37 -0000      1.25
  @@ -97,8 +97,6 @@
   
       protected String name;
   
  -    protected int debug = 0;
  -
       protected boolean distributable = true;
   
       protected CatalinaCluster cluster;
  @@ -137,7 +135,7 @@
       }
   
       public void setCluster(CatalinaCluster cluster) {
  -        this.log("Cluster associated with SimpleTcpReplicationManager");
  +        this.log.debug("Cluster associated with SimpleTcpReplicationManager");
           this.cluster = cluster;
       }
   
  @@ -148,7 +146,7 @@
   
       public void setPrintToScreen(boolean printtoscreen)
       {
  -        log("Setting screen debug to:"+printtoscreen);
  +        log.debug("Setting screen debug to:"+printtoscreen);
           mPrintToScreen = printtoscreen;
       }
   
  @@ -166,15 +164,6 @@
           }
       }
   
  -    public int getDebug()
  -    {
  -        return this.debug;
  -    }
  -
  -    public void setDebug(int debug) {
  -        this.debug = debug;
  -        //super.setDebug(debug);
  -    }
       /**
        * Creates a HTTP session.
        * Most of the code in here is copied from the StandardManager.
  @@ -314,7 +303,7 @@
                       }
   
                       session.setIsDirty(false);
  -                    if (getDebug() > 5) {
  +                    if (log.isDebugEnabled()) {
                           try {
                               log.debug("Sending session to cluster=" + session);
                           }
  @@ -330,7 +319,7 @@
           }
           catch (Exception x )
           {
  -            log("Unable to replicate session",x);
  +            log.error("Unable to replicate session",x);
           }
           return null;
       }
  @@ -361,7 +350,7 @@
           }
           catch ( Exception x )
           {
  -            log("Failed to serialize the session!",x,1);
  +            log.error("Failed to serialize the session!",x);
           }
           return null;
       }
  @@ -422,7 +411,7 @@
           }
           catch ( Exception x )
           {
  -            log("Failed to deserialize the session!",x,1);
  +            log.error("Failed to deserialize the session!",x);
           }
           return null;
       }
  @@ -448,9 +437,9 @@
           try {
               //the channel is already running
               if ( mChannelStarted ) return;
  -            log("Starting clustering manager...:"+getName(),1);
  +            log.error("Starting clustering manager...:"+getName());
               if ( cluster == null ) {
  -                log("Starting... no cluster associated with this 
context:"+getName(),1);
  +                log.error("Starting... no cluster associated with this 
context:"+getName());
                   return;
               }
   
  @@ -485,7 +474,7 @@
               }//end if
               mChannelStarted = true;
           }  catch ( Exception x ) {
  -            log("Unable to start SimpleTcpReplicationManager",x,1);
  +            log.error("Unable to start SimpleTcpReplicationManager",x);
           }
       }
   
  @@ -513,7 +502,7 @@
           }
           catch ( Exception x )
           {
  -            log("Unable to stop javagroups channel",x,1);
  +            log.error("Unable to stop SimpleTcpReplicationManager",x);
           }
       }
   
  @@ -535,8 +524,8 @@
        */
       protected void messageReceived( SessionMessage msg, Member sender ) {
           try  {
  -            log("Received SessionMessage of type="+msg.getEventTypeString(),3);
  -            log("Received SessionMessage sender="+sender,3);
  +            log.debug("Received SessionMessage of type="+msg.getEventTypeString());
  +            log.debug("Received SessionMessage sender="+sender);
               switch ( msg.getEventType() ) {
                   case SessionMessage.EVT_GET_ALL_SESSIONS: {
                       //get a list of all the session from this manager
  @@ -577,8 +566,8 @@
                   }
                   case SessionMessage.EVT_SESSION_CREATED: {
                       Session session = 
this.readSession(msg.getSession(),msg.getSessionID());
  -                    if ( getDebug()  > 5 ) {
  -                        log("Received replicated session=" + session +
  +                    if ( log.isDebugEnabled() ) {
  +                        log.debug("Received replicated session=" + session +
                               " isValid=" + session.isValid());
                       }
                       break;
  @@ -607,7 +596,7 @@
           }
           catch ( Exception x )
           {
  -            log("Unable to receive message through TCP channel",x,1);
  +            log.error("Unable to receive message through TCP channel",x);
           }
       }
   
  @@ -615,7 +604,7 @@
           try {
               messageReceived(msg, 
msg.getAddress()!=null?(Member)msg.getAddress():null);
           } catch(Throwable ex){
  -            log("InMemoryReplicationManager.messageDataReceived()", ex);
  +            log.error("InMemoryReplicationManager.messageDataReceived()", ex);
           }//catch
       }
   
  @@ -623,31 +612,6 @@
           return stateTransferred;
       }
   
  -    public void log(String msg)  {
  -        log(msg,3);
  -    }
  -
  -    public void log(String msg, Throwable x) {
  -        log(msg,x,3);
  -    }
  -    public void log(String msg, int level) {
  -        if ( getDebug() >= level ) {
  -            String lmsg = msg;
  -            if ( mPrintToScreen ) System.out.println(lmsg);
  -            log.info(lmsg);
  -        }
  -    }
  -
  -    public void log(String msg, Throwable x, int level)  {
  -        if ( getDebug() >= level )  {
  -            String lmsg = msg;
  -            if ( mPrintToScreen ) {
  -                System.out.println(lmsg);
  -                x.printStackTrace();
  -            }
  -            log.error(lmsg,x);
  -        }//end if
  -    }
       public void setName(String name) {
           this.name = name;
       }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to