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 Iwan Tomlow <iw...@seagha.com> on 2005/08/31 15:42:02 UTC

RE: 0.9.8 and RollingFileAppender

Hi,

I posted a similar problem and my fix some weeks ago as 'Should properties
file be changed after v0.9.7?':
===
However, I noticed that rolling.RFA with a TimeBasedRollingPolicy wasn't
working either, so I figured it had the same problem as
DailyRollingFileAppender. After further lookup, I got it working with the
following change:

TimeBasedRollingPolicy.h, Ln 138:
        class LOG4CXX_EXPORT TimeBasedRollingPolicy : public
RollingPolicyBase,
             public TriggeringPolicy {
-          DECLARE_ABSTRACT_LOG4CXX_OBJECT(TimeBasedRollingPolicy)
+          DECLARE_LOG4CXX_OBJECT(TimeBasedRollingPolicy)
 
I don't know how this affects other stuff, but the DECLARE_ABSTRACT prevents
a TimeBasedRollingPolicy from being created with newInstance(). 

Just wanted to let you know...
===

The "Cannot create new instances of Class" sounds a lot like the same
problem with abstract class.
Doesn't look like it's been changed in the CVS, but the fix worked for me.

Kind regards,

Iwan Tomlow


-----Original Message-----
From: rene@modery.net [mailto:rene@modery.net] 
Sent: woensdag 31 augustus 2005 17:19
To: log4cxx-user@logging.apache.org
Subject: 0.9.8 and RollingFileAppender


Hi,

I'm using todays log4cxx version from
http://littletux.homelinux.org/log4cxx/ . If I try to use a XML
configuration file, I get the following error:

log4cxx: Could not create the RollingPolicy. Reported error follows.
log4cxx: Cannot create new instances of Class.


The appender looks as follows:

<appender name="FileAppender"
class="org.apache.log4j.rolling.RollingFileAppender">
       <rollingPolicy
class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
          <param name="fileNamePattern"
value="test1-%d{yyyy-MM-dd_HH_mm_ss}"/>
       </rollingPolicy>
       <layout class="org.apache.log4j.HTMLLayout">
       </layout>
  </appender>



The only file created (and used) is called .1
Is there an error in my XML config or is it an error in the log4cxx-code?


Regards
Rene