cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vadim Gritsenko <va...@reverycodes.com>
Subject Re: Cocoon read-only (ex: CD-ROM) add ${context-work} parameter to logkit.xconf from CocoonServlet.java
Date Wed, 27 Oct 2004 20:25:26 GMT
Frédéric Glorieux wrote:
> 
> For sysadmin, it may be important for the cocoon servlet to be totally 
> read-only, even logs. I used to try to run a same cocoon in parallel in 
> different servlet contexts (same JVM, same tomcat, different URIs). Logs 
> were quite funny to read but a bit broken. For a fast patch, I added 2 
> lines in *CocoonServlet.java* to make cocoon write is logs in work.
> 
> line 774
>         subcontext.put("servlet-context", this.servletContext);
>         if (this.servletContextPath == null) {
>             File logSCDir = new File(this.workDir, "log");
>             logSCDir.mkdirs();
>             if (logger.isWarnEnabled()) {
>                 logger.warn("Setting servlet-context for LogKit to " +     
>         logSCDir);
>             }
>             subcontext.put("context-root", logSCDir.toString());
> +           subcontext.put("context-work", this.workDir);
>         } else {
>             subcontext.put("context-root", this.servletContextPath);
> +           subcontext.put("context-work", this.workDir);
>         }
> 
> Same is easy to do with a log Target, Forrest gave us an example here
> http://svn.apache.org/viewcvs.cgi/forrest/trunk/src/java/org/apache/forrest/log/ 
> 
> but this is a so little change ? I can't guess consequences in a so 
> central class.

Beside CocoonServlet, there are 4 more places like this: CocoonPortlet, 
ManagedCocoonPortlet, BeanWrapper, and CocoonTask. And, work directory is 
available (after my commit) in the context as "work-directory" entry. So, in 
logkit.xconf you can simply write:

     <cocoon id="sitemap">
       <filename>${work-directory}/logs/sitemap.log</filename>
       <format type="cocoon">
         %7.7{priority} %{time}   [%{category}] (%{uri}) 
%{thread}/%{class:short}: %{message}\n%{throwable}
       </format>
       <append>false</append>
     </cocoon>


Vadim

Mime
View raw message