You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-user@logging.apache.org by Andrew n marshall <am...@ISI.EDU> on 2007/12/10 20:59:35 UTC

Default Initialization Procedure

I'm trying to build a small test project that uses the "Default 
Initialization Procedure" described in the Short Introduction.  It 
refers to setting "the configurationOptionStr string variable".  I'm not 
sure where this variable is, and searching the sources didn't reveal 
anything either.

Can someone present the snippet of code showing how to enable this 
runtime configuration?


Anm

Re: XML Configuration

Posted by Andrew n marshall <am...@ISI.EDU>.
My mistake.  The percent sign in %d is there in the header file, but it 
does not show up in the generated web docs.  This also affects 
timebasedrollingpolicy.h.

Andrew n marshall wrote:
> Curt Arnold wrote:
>> You do not have a % (percent) character before the d to introduce the 
>> date format.  I assume that log4cxx is treating the whole pattern as 
>> a literal and the message is an indication that it did not locate a 
>> date pattern in the FileNamePattern value.  There is an example in 
>> src/test/resources/input/rolling/time.xml.
>
>
> Yes that fixed it.
>
> The docs need to be updated accordingly.  In the detailed description of:
>   
> http://logging.apache.org/log4cxx/apidocs/classlog4cxx_1_1rolling_1_1RollingFileAppender.html 
>
> the XML example has the bug you noticed and a spurious " in the <root> 
> tag (rollingfileappender.h).
>
>
> Anm


Re: XML Configuration

Posted by Andrew n marshall <am...@ISI.EDU>.
Curt Arnold wrote:
> You do not have a % (percent) character before the d to introduce the 
> date format.  I assume that log4cxx is treating the whole pattern as a 
> literal and the message is an indication that it did not locate a date 
> pattern in the FileNamePattern value.  There is an example in 
> src/test/resources/input/rolling/time.xml.


Yes that fixed it.

The docs need to be updated accordingly.  In the detailed description of:
   
http://logging.apache.org/log4cxx/apidocs/classlog4cxx_1_1rolling_1_1RollingFileAppender.html
the XML example has the bug you noticed and a spurious " in the <root> 
tag (rollingfileappender.h).


Anm

Re: XML Configuration

Posted by Curt Arnold <ca...@apache.org>.
On Dec 11, 2007, at 11:34 AM, Andrew n marshall wrote:

> Until I hear how to configure with the default initialization, I am  
> using the DOMConfigurator directly.  My log4cxx.xml contains a  
> snippet from the RollingFileAppender documentation:
>

You do not have a % (percent) character before the d to introduce the  
date format.  I assume that log4cxx is treating the whole pattern as a  
literal and the message is an indication that it did not locate a date  
pattern in the FileNamePattern value.  There is an example in src/test/ 
resources/input/rolling/time.xml.


XML Configuration

Posted by Andrew n marshall <am...@ISI.EDU>.
Until I hear how to configure with the default initialization, I am 
using the DOMConfigurator directly.  My log4cxx.xml contains a snippet 
from the RollingFileAppender documentation:

    <appender name="ROLL" 
class="org.apache.log4j.rolling.RollingFileAppender">
        <rollingPolicy 
class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
            <param name="FileNamePattern" value="log.d{yyyy-MM}.xml"/>
        </rollingPolicy>

        <layout class="org.apache.log4j.XMLLayout"/>
    </appender>

but the DOMConfigurator chokes on the rollingPolicy:

log4cxx: Parsing rolling policy of class: 
"org.apache.log4j.rolling.TimeBasedRollingPolicy"
log4cxx: Setting option name=[FileNamePattern], value=[log.d{yyyy-MM}.xml]
log4cxx: Could not create the RollingPolicy. Reported error follows.
log4cxx: Illegal state

I'm guessing it is the XML snippet that is the culprit, as it has other 
issues (<root">).  Does anyone have a working example input?  Or is this 
just a bug in the code?


Anm