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/03 06:43:20 UTC

cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/core BaseInterceptor.java Context.java ContextManager.java

costin      01/02/02 21:43:20

  Modified:    src/share/org/apache/tomcat/core BaseInterceptor.java
                        Context.java ContextManager.java
  Log:
  Few changes needed to finish the LogSetter.
  
  - ContextManager is no longer a "Log" manager - LogSetter is just setting
  the Log tomcat will use ( instead of storing the logs in CM and then
  processing them, etc )
  
  - use better names for the log channel ( org/apache/tomcat/core ,
  org/apache/tomcat/facade )
  
  - no LogAware - LogSetter is doing the job of plugging the log in the
  context and CM.
  
  Revision  Changes    Path
  1.40      +1 -3      jakarta-tomcat/src/share/org/apache/tomcat/core/BaseInterceptor.java
  
  Index: BaseInterceptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/BaseInterceptor.java,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- BaseInterceptor.java	2001/02/01 04:47:12	1.39
  +++ BaseInterceptor.java	2001/02/03 05:43:18	1.40
  @@ -102,7 +102,7 @@
       protected int debug=0;
   
       //  loghelper will use name of actual impl subclass
  -    protected Log loghelper = new Log("tc_log", this);
  +    protected Log loghelper = Log.getLog("org/apache/tomcat/core", this);
   
       public BaseInterceptor() {
       }
  @@ -537,7 +537,6 @@
       public final void setContextManager( ContextManager cm ) {
   	this.cm=cm;
   	this.ct=cm.getContainer();
  -	loghelper.setLogger(cm.getLogger());
       }
   
       public final ContextManager getContextManager() {
  @@ -551,7 +550,6 @@
   	this.ctx=ctx;
   	this.cm=ctx.getContextManager();
   	this.ct=ctx.getContainer();
  -	loghelper.setLogger(ctx.getLog().getLogger());
       }
   
       public Context getContext() {
  
  
  
  1.135     +8 -16     jakarta-tomcat/src/share/org/apache/tomcat/core/Context.java
  
  Index: Context.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/Context.java,v
  retrieving revision 1.134
  retrieving revision 1.135
  diff -u -r1.134 -r1.135
  --- Context.java	2001/02/01 05:06:04	1.134
  +++ Context.java	2001/02/03 05:43:18	1.135
  @@ -98,7 +98,7 @@
    * @author costin@dnt.ro
    * @author Gal Shachor shachor@il.ibm.com
    */
  -public final class Context implements LogAware {
  +public final class Context {
       // -------------------- Constants --------------------
       
       // Proprietary attribute names for contexts - defined
  @@ -236,7 +236,7 @@
       private boolean trusted=false;
   
       // log channels for context and servlets 
  -    private Log loghelper = new Log("tc_log", this);
  +    private Log loghelper = Log.getLog("org/apache/tomcat/core", this);
       private Log loghelperServlet;
   
       // servlet API implemented by this Context
  @@ -420,7 +420,7 @@
   	// check if we can access this attribute.
   	if( isTrusted() ) return true;
   	log( "Attempt to access internal attribute in untrusted app",
  -	     null, Logger.ERROR);
  +	     null, Log.ERROR);
   	return false;
       }
   
  @@ -1070,7 +1070,7 @@
       public final  void logServlet( String msg , Throwable t ) {
   	if (loghelperServlet == null) {
   	    String pr= getId();
  -	    loghelperServlet = new Log("servlet_log", pr );
  +	    loghelperServlet = Log.getLog("org/apache/tomcat/facade", pr );
   	}
   	if (t == null)
   	    loghelperServlet.log(msg);	// uses level INFORMATION
  @@ -1078,20 +1078,12 @@
   	    loghelperServlet.log(msg, t); // uses level ERROR
       }
   
  -    public final  void setLogger(Logger logger) {
  -	if (loghelper == null) {
  -	    String pr=getId();
  -	    loghelper = new Log("tc_log", pr );
  -	}
  -	loghelper.setLogger(logger);
  +    public final  void setLog(Log logger) {
  +	loghelper=logger;
       }
   
  -    public final  void setServletLogger(Logger logger) {
  -	if (loghelperServlet == null) {
  -	    String pr=getId();
  -	    loghelperServlet = new Log("servlet_log",pr);
  -	}
  -	loghelperServlet.setLogger(logger);
  +    public final  void setServletLog(Logger logger) {
  +	loghelperServlet=logger;
       }
   
       public final  Log getLog() {
  
  
  
  1.165     +9 -31     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.164
  retrieving revision 1.165
  diff -u -r1.164 -r1.165
  --- ContextManager.java	2001/02/01 05:06:04	1.164
  +++ ContextManager.java	2001/02/03 05:43:18	1.165
  @@ -145,7 +145,7 @@
     @author Costin Manolache
     @author Hans Bergsten [hans@gefionsoftware.com]
    */
  -public final class ContextManager implements LogAware{
  +public final class ContextManager {
       /** Official name and version
        */
       public static final String TOMCAT_VERSION = "3.3 dev";
  @@ -209,10 +209,6 @@
       // the embedding application loader. @see getParentLoader
       private ClassLoader parentLoader;
   
  -    // Store Loggers that are used in this server
  -    // XXX use Log.getLog() instead!!
  -    private Hashtable loggers=new Hashtable();
  -
       private Hashtable properties=new Hashtable();
       
       /**
  @@ -510,6 +506,7 @@
   	Enumeration enum = getContexts();
   	while (enum.hasMoreElements()) {
   	    Context ctx = (Context)enum.nextElement();
  +	    ctx.setContextManager( this );
   	    try {
   		for( int i=0; i<existingI.length; i++ ) {
   		    existingI[i].addContext( this, ctx );
  @@ -1027,41 +1024,22 @@
       }
       
       // -------------------- Logging and debug --------------------
  -    private Log loghelper = new Log("tc_log", "ContextManager");
   
  +    // default, is going to console until replaced (unless aleady configured)
  +    private Log loghelper = Log.getLog("org/apache/tomcat/core",
  +				       "ContextManager");
       /**
  -     * Get the Logger object that the context manager is writing to (necessary?)
  -     **/
  -    public final Logger getLogger() {
  -	return loghelper.getLogger();
  -    }
  -
  -    /**
        * So other classes can piggyback on the context manager's log
  -     * stream, using Logger.Helper.setProxy()
  +     * stream.
        **/
       public final Log getLog() {
   	return loghelper;
       }
  - 
  -    /**
  -     * Force this object to use the given Logger.
  -     **/
  -    public final void setLogger( Logger logger ) {
  -	log("!!!! setLogger: " + logger, Logger.DEBUG);
  -	loghelper.setLogger(logger);
  -    }
  -
  -    public final void addLogger(Logger l) {
  -	if (debug>20)
  -	    log("addLogger: " + l, new Throwable("trace"), Logger.DEBUG);
  -        loggers.put(l.toString(),l);
  -    }
   
  -    public final Hashtable getLoggers(){
  -        return loggers;
  +    public final void setLog(Log log) {
  +	loghelper=log;
       }
  -
  + 
       public final void log(String msg) {
   	loghelper.log(msg);
       }