tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From na...@locus.apache.org
Subject cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/core ContextManager.java
Date Thu, 12 Oct 2000 22:41:51 GMT
nacho       00/10/12 15:41:51

  Modified:    src/share/org/apache/tomcat/context DefaultCMSetter.java
               src/share/org/apache/tomcat/core ContextManager.java
  Log:
  Moved loggers initializing to DefaultCMSetter,  to isolate all the
  init actions into it and permit that loggers get the correct paths.
  
  Revision  Changes    Path
  1.57      +20 -1     jakarta-tomcat/src/share/org/apache/tomcat/context/DefaultCMSetter.java
  
  Index: DefaultCMSetter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/context/DefaultCMSetter.java,v
  retrieving revision 1.56
  retrieving revision 1.57
  diff -u -r1.56 -r1.57
  --- DefaultCMSetter.java	2000/10/08 01:02:25	1.56
  +++ DefaultCMSetter.java	2000/10/12 22:41:50	1.57
  @@ -139,9 +139,28 @@
   				 workDir);
   	}
   	cm.setWorkDir( workDir );
  +        initLoggers(cm.getLoggers());
  +    }
   
  +    private void initLoggers(Hashtable Loggers){
  +        if( Loggers!=null ){
  +            Enumeration el=Loggers.elements();
  +            while( el.hasMoreElements()){
  +                Logger l=(Logger)el.nextElement();
  +                String path=l.getPath();
  +                if( path!=null ) {
  +                    File f=new File( path );
  +                    if( ! f.isAbsolute() ) {
  +                        File wd= new File(cm.getHome(), f.getPath());
  +                        l.setPath( wd.getAbsolutePath() );
  +                    }
  +                    // create the files, ready to log.
  +                }
  +                l.open();
  +            }
  +        }
       }
  -    
  +
       /** Adjust paths
        */
       public void addContext( ContextManager cm, Context ctx)
  
  
  
  1.145     +13 -16    jakarta-tomcat/src/share/org/apache/tomcat/core/ContextManager.java
  
  Index: ContextManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ContextManager.java,v
  retrieving revision 1.144
  retrieving revision 1.145
  diff -u -r1.144 -r1.145
  --- ContextManager.java	2000/10/08 01:02:29	1.144
  +++ ContextManager.java	2000/10/12 22:41:50	1.145
  @@ -253,7 +253,10 @@
       private ClassLoader parentLoader;
       // tomcat classes ( used to load tomcat)
       private URL serverClassPath[];
  -    
  +
  +    // Store Loggers before initializing them
  +    private Hashtable Loggers;
  +
       private Counters cntr=new Counters(ACCOUNTS);
   
       /**
  @@ -291,11 +294,10 @@
   	}
   
   	state=STATE_INIT;
  -
   	Enumeration existingCtxE=contextsV.elements();
   	while( existingCtxE.hasMoreElements() ) {
   	    Context ctx=(Context)existingCtxE.nextElement();
  -	    
  +
   	    cI=getInterceptors(ctx.getContainer());
   	    for( int i=0; i< cI.length; i++ ) {
   		cI[i].addContext( this, ctx );
  @@ -957,17 +959,12 @@
       public final void addLogger(Logger l) {
   	if (debug>20)
   	    log("addLogger: " + l, new Throwable("trace"), Logger.DEBUG);
  +        if( Loggers==null ) Loggers=new Hashtable();
  +        Loggers.put(l.toString(),l);
  +    }
   
  -	String path=l.getPath();
  -	if( path!=null ) {
  -	    File f=new File( path );
  -	    if( ! f.isAbsolute() ) {
  -		File wd= new File(getHome(), f.getPath());
  -		l.setPath( wd.getAbsolutePath() );
  -	    }
  -	    // create the files, ready to log.
  -	}
  -	l.open();
  +    public final Hashtable getLoggers(){
  +        return Loggers;
       }
   
       public final void log(String msg) {
  @@ -975,15 +972,15 @@
       }
   
       public final void log(String msg, Throwable t) {
  -	loghelper.log(msg, t);
  +        loghelper.log(msg, t);
       }
   
       public final void log(String msg, int level) {
  -	loghelper.log(msg, level);
  +        loghelper.log(msg, level);
       }
   
       public final void log(String msg, Throwable t, int level) {
  -	loghelper.log(msg, t, level);
  +        loghelper.log(msg, t, level);
       }
   
   }
  
  
  

Mime
View raw message