2008/7/29 Robert La Ferla <[EMAIL PROTECTED]>:
> I would like to configure Cocoon 2.1.11 so that every day (24 hrs), the
> cocoon.log is written to a new file (cocoon-2008-JUL-29.log)  I tried
> configuring logkit.xconf to do this but it doesn't work.

Yes it does, ours are rolling over daily just fine. :-)

> Because I didn't
> want to wait a full day to see if it worked, I changed the configuration to
> rotate every minute.   It didn't work.  It either kept a single file or two
> files but never anymore.  I do not care about size.
>
> I would have expected it to create:
>
> cocoon-2008-JUL-29_12-01.log
> cocoon-2008-JUL-29_12-02.log
> cocoon-2008-JUL-29_12-03.log
> cocoon-2008-JUL-29_12-04.log
> ...
>
>    <!--+
>         | <append> if set to 'true' will make cocoon append the events
>         | to the existing file, if set to 'false' cocoon will override
>         | the existing ones at every new start.
>         +-->
>     <append>true</append>
>     <!--+
>         | <rotation> allows you to rotate log files one they meet certain
>         | criteria. If you uncomment the example below, the log files will
>         | be rotated once they are a day old or bigger than 100 Mb.
>         +-->
>     <rotation type="unique" pattern="yyyy-MMM-dd_HH-mm" suffix=".log">
>            <time>00:01:00</time>
>     </rotation>

Just because the pattern includes the HH-mm, won't make it roll over
any more often.  It just means the files will be named
cocoon-2008-JUL-29_00-01.log
cocoon-2008-JUL-30_00-01.log
when they roll over at the time (a minute past midnight) you
specified.  At least, that's how I interpret the javadocs:
 *  <dt>&lt;time&gt;</dt>
 *  <dd>
 *   The time as HH:MM:SS when a rotation should occur. If you like to rotate
 *   a logfile more than once a day put an &lt;or&gt; element
immediately after the
 *   &lt;rotation&gt; element and specify the times inside the
 *   &lt;or&gt; element.
 *  </dd>
To roll over every minute would need an <or> element containing 1440
<time> entries...

> Is this a Cocoon bug or is my configuration incorrect?

Since we're using an older version than 2.1.11, I suppose it's always
possible a bug has appeared in the meantime.  My money's on your
configuration, though.

>  Is there a way to
> use log4j instead of LogKit?

There's a log4j.xconf in the sample web app as well as a logkit.xconf,
so I expect so.  Not sure how to configure things to use it, though.
There's a commented out init-param in the web.xml
      <param-name>force-property</param-name>
      
<param-value>org.apache.commons.logging.Log=org.apache.commons.logging.impl.LogKitLogger
    </param-value>
and another couple
                <!--
      This parameter switches the logging system from LogKit to Log4J
for Cocoon.
      Log4J has to be configured already.
      <init-param>
        <param-name>logger-class</param-name>
        
<param-value>org.apache.avalon.excalibur.logger.Log4JLoggerManager</param-value>
      </init-param>
    -->
                <!--
      If you want to configure log4j using Cocoon, then you can define
      an XML configuration file here. You can use the usual log4j property
      substituation mechanism, e.g. ${context-root} is replaced by the
      context root of this web application etc.
      You can configure the log4j configuration even if you use LogKit
      for Cocoon logging. You can use this to configure third party code
      for example.
      <init-param>
        <param-name>log4j-config</param-name>
        <param-value>/WEB-INF/log4j.xconf</param-value>
      </init-param>
    -->
so perhaps enabling those last two and/or setting the first one to
org.apache.commons.logging.impl.Log4JLogger will do it?


Andy.
-- 
http://pseudoq.sourceforge.net/  Open source java sudoku solver

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to