vgritsenko    01/08/18 11:15:37

  Modified:    src/org/apache/cocoon/servlet CocoonServlet.java
               webapp/WEB-INF web.xml
  Log:
  Patch from Marcus Crafter to allow appending to the cocoon log
  
  Revision  Changes    Path
  1.31      +9 -2      xml-cocoon2/src/org/apache/cocoon/servlet/CocoonServlet.java
  
  Index: CocoonServlet.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/servlet/CocoonServlet.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- CocoonServlet.java        2001/08/16 14:01:53     1.30
  +++ CocoonServlet.java        2001/08/18 18:15:36     1.31
  @@ -64,7 +64,7 @@
    * @author <a href="mailto:[EMAIL PROTECTED]";>Nicola Ken Barozzi</a> Aisa
    * @author <a href="mailto:[EMAIL PROTECTED]";>Berin Loritsch</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Carsten Ziegeler</a>
  - * @version CVS $Revision: 1.30 $ $Date: 2001/08/16 14:01:53 $
  + * @version CVS $Revision: 1.31 $ $Date: 2001/08/18 18:15:36 $
    */
   
   public class CocoonServlet extends HttpServlet {
  @@ -363,6 +363,9 @@
   
               this.appContext.put(Constants.CONTEXT_LOG_FILE, logName);
   
  +            String value = getInitParameter("log-append");
  +            boolean logAppend = (value == null || value.equals("yes") || 
value.equals("true"));
  +
               final String path = logDir + logName;
               Formatter formatter;
               if (logFormat == null || logFormat.equalsIgnoreCase("xml") == false) {
  @@ -378,7 +381,7 @@
               this.log = Hierarchy.getDefaultHierarchy().getLoggerFor("cocoon");
               this.log.setPriority(logPriority);
   
  -            FileTarget fileTarget = new FileTarget(new File(path), false, 
formatter);
  +            FileTarget fileTarget = new FileTarget(new File(path), logAppend, 
formatter);
               ServletOutputLogTarget servTarget = new 
ServletOutputLogTarget(this.servletContext);
   
               servTarget.setFormatter(formatter);
  @@ -387,6 +390,10 @@
               filter.addTarget( servTarget );
               LogTarget[] targets = new LogTarget[] { fileTarget, filter };
               this.log.setLogTargets( targets );
  +
  +            if (logAppend)
  +                this.log.info("Appending to previous log file, if existing");
  +
           } catch (Exception e) {
               Hierarchy.getDefaultHierarchy().log("Could not set up Cocoon Logger, 
will use screen instead", e);
           }
  
  
  
  1.10      +10 -0     xml-cocoon2/webapp/WEB-INF/web.xml
  
  Index: web.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/webapp/WEB-INF/web.xml,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- web.xml   2001/08/09 12:25:35     1.9
  +++ web.xml   2001/08/18 18:15:37     1.10
  @@ -98,6 +98,16 @@
       -->
     
       <!-- 
  +      This boolean value parameter specifies whether the cocoon log file
  +      should be appended to or not.
  +
  +    <init-param>
  +      <param-name>log-append</param-name>
  +      <param-value>true</param-value>
  +    </init-param>
  +    -->
  +  
  +    <!-- 
         Allow reinstantiating (reloading) of the cocoon instance. If this is
         set to "yes" or "true", a new cocoon instance can be created using
         the request parameter "cocoon-reload".
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     [EMAIL PROTECTED]
To unsubscribe, e-mail:          [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to