Hi All,

        Hope all is well.

        Attached is a patch which adds support for appending to the cocoon.log
        log file. The patch adds an init-param in the web.xml, which is read
        by CocoonServlet and passed accordingly to the FileTarget logkit
        constructor.

        Cheers,

        Marcus

-- 
        .....
     ,,$$$$$$$$$,      Marcus Crafter
    ;$'      '$$$$:    Computer Systems Engineer
    $:         $$$$:   Open Software Associates GmbH
     $       o_)$$$:   82-84 Mainzer Landstrasse
     ;$,    _/\ &&:'   60327 Frankfurt Germany
       '     /( &&&
           \_&&&&'     Email : [EMAIL PROTECTED]
          &&&&.        Business Hours : +49 69 9757 200
    &&&&&&&:
Index: src/org/apache/cocoon/servlet/CocoonServlet.java
===================================================================
RCS file: 
/home/cvspublic/xml-cocoon2/src/org/apache/cocoon/servlet/CocoonServlet.java,v
retrieving revision 1.30
diff -u -r1.30 CocoonServlet.java
--- src/org/apache/cocoon/servlet/CocoonServlet.java    2001/08/16 14:01:53     1.30
+++ src/org/apache/cocoon/servlet/CocoonServlet.java    2001/08/18 13:46:51
@@ -363,6 +363,8 @@
 
             this.appContext.put(Constants.CONTEXT_LOG_FILE, logName);
 
+            Boolean logAppend = new Boolean(getInitParameter("log-append"));
+
             final String path = logDir + logName;
             Formatter formatter;
             if (logFormat == null || logFormat.equalsIgnoreCase("xml") == false) {
@@ -378,7 +380,8 @@
             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.booleanValue(), 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.equals(Boolean.TRUE))
+                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);
         }
Index: webapp/WEB-INF/web.xml
===================================================================
RCS file: /home/cvspublic/xml-cocoon2/webapp/WEB-INF/web.xml,v
retrieving revision 1.9
diff -u -r1.9 web.xml
--- webapp/WEB-INF/web.xml      2001/08/09 12:25:35     1.9
+++ webapp/WEB-INF/web.xml      2001/08/18 13:46:51
@@ -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".
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to