tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/servlet JspServlet.java
Date Sun, 05 Sep 2004 22:22:25 GMT
markt       2004/09/05 15:22:24

  Modified:    jasper2/src/share/org/apache/jasper Tag: tomcat_4_branch
                        Constants.java
               jasper2/src/share/org/apache/jasper/servlet Tag:
                        tomcat_4_branch JspServlet.java
  Log:
  Stop JspServlet log messages from one context appearing in the log
  for another. This is the relatively simple fix. A better fix would be to
  replace org.apache.jasper.logging completely as per TC5.
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.4.2.3   +8 -1      jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/Constants.java
  
  Index: Constants.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/Constants.java,v
  retrieving revision 1.4.2.2
  retrieving revision 1.4.2.3
  diff -u -r1.4.2.2 -r1.4.2.3
  --- Constants.java	26 Aug 2004 18:25:52 -0000	1.4.2.2
  +++ Constants.java	5 Sep 2004 22:22:24 -0000	1.4.2.3
  @@ -29,6 +29,14 @@
    * @author Harish Prabandham
    */
   public class Constants {
  +    
  +    public static Logger jasperLog = null;
  +
  +    static {
  +        jasperLog = Logger.getDefaultLogger();
  +        jasperLog.setName("JASPER_LOG");
  +    }
  +
       /**
        * The base class of the generated servlets. 
        */
  @@ -248,6 +256,5 @@
           }
       }
   
  -    public static Logger jasperLog = null;
   }
   
  
  
  
  No                   revision
  No                   revision
  1.12.2.5  +23 -29    jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/servlet/JspServlet.java
  
  Index: JspServlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/servlet/JspServlet.java,v
  retrieving revision 1.12.2.4
  retrieving revision 1.12.2.5
  diff -u -r1.12.2.4 -r1.12.2.5
  --- JspServlet.java	25 Aug 2004 20:55:27 -0000	1.12.2.4
  +++ JspServlet.java	5 Sep 2004 22:22:24 -0000	1.12.2.5
  @@ -54,7 +54,7 @@
    */
   public class JspServlet extends HttpServlet {
   
  -    private Logger.Helper loghelper;
  +    private Logger logger;
   
       private ServletContext context;
       private ServletConfig config;
  @@ -69,22 +69,20 @@
           this.context = config.getServletContext();
           
           // Setup logging 
  -        Constants.jasperLog = new DefaultLogger(this.context);
  -        Constants.jasperLog.setName("JASPER_LOG");
  -        Constants.jasperLog.setTimestamp("false");
  -        Constants.jasperLog.setVerbosityLevel(
  +        logger = new DefaultLogger(this.context);
  +        logger.setTimestamp("false");
  +        logger.setVerbosityLevel(
               config.getInitParameter("logVerbosityLevel"));
  -        loghelper = new Logger.Helper("JASPER_LOG", "JspServlet");
   
           options = new EmbededServletOptions(config, context);
   
           // Initialize the JSP Runtime Context
           rctxt = new JspRuntimeContext(context,options);
   
  -        Constants.message("jsp.message.scratch.dir.is", 
  -            new Object[] { options.getScratchDir().toString() },
  +        logger.log(Constants.getString("jsp.message.scratch.dir.is",
  +            new Object[] { options.getScratchDir().toString() } ), 
               Logger.INFORMATION );
  -        Constants.message("jsp.message.dont.modify.servlets",
  +        logger.log(Constants.getString("jsp.message.dont.modify.servlets"),
               Logger.INFORMATION);
       }
   
  @@ -164,28 +162,25 @@
   
               boolean precompile = preCompile(request);
   
  -            Logger jasperLog = Constants.jasperLog;
  -            
  -            if (jasperLog != null
  -                    && jasperLog.matchVerbosityLevel(Logger.INFORMATION))
  +            if (logger.matchVerbosityLevel(Logger.INFORMATION))
                   {
  -                    jasperLog.log("JspEngine --> "+jspUri);
  -                    jasperLog.log("\t     ServletPath: " +
  -                                  request.getServletPath());
  -                    jasperLog.log("\t        PathInfo: " +
  -                                  request.getPathInfo());
  -                    jasperLog.log("\t        RealPath: " +
  -                                  context.getRealPath(jspUri));
  -                    jasperLog.log("\t      RequestURI: " +
  -                                  request.getRequestURI());
  -                    jasperLog.log("\t     QueryString: " +
  -                                  request.getQueryString());
  -                    jasperLog.log("\t  Request Params: ");
  +                    logger.log("JspEngine --> "+jspUri);
  +                    logger.log("\t     ServletPath: " +
  +                               request.getServletPath());
  +                    logger.log("\t        PathInfo: " +
  +                               request.getPathInfo());
  +                    logger.log("\t        RealPath: " +
  +                               context.getRealPath(jspUri));
  +                    logger.log("\t      RequestURI: " +
  +                               request.getRequestURI());
  +                    logger.log("\t     QueryString: " +
  +                               request.getQueryString());
  +                    logger.log("\t  Request Params: ");
                       Enumeration e = request.getParameterNames();
                       while (e.hasMoreElements()) {
                           String name = (String) e.nextElement();
  -                        jasperLog.log("\t\t " + name + " = " +
  -                                      request.getParameter(name));
  +                        logger.log("\t\t " + name + " = " +
  +                                   request.getParameter(name));
                       }
                   }
               serviceJspFile(request, response, jspUri, null, precompile);
  @@ -203,8 +198,7 @@
   
       public void destroy() {
   
  -        if (Constants.jasperLog != null)
  -            Constants.jasperLog.log("JspServlet.destroy()", Logger.INFORMATION);
  +        logger.log("JspServlet.destroy()", Logger.INFORMATION);
   
           rctxt.destroy();
       }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message