You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-dev@logging.apache.org by ca...@apache.org on 2008/02/16 19:34:10 UTC
svn commit: r628371 - in /logging/log4cxx/trunk/src/main: cpp/
include/log4cxx/ include/log4cxx/rolling/
Author: carnold
Date: Sat Feb 16 10:34:08 2008
New Revision: 628371
URL: http://svn.apache.org/viewvc?rev=628371&view=rev
Log:
LOGCXX-220: VC6 issues, Apply same fix to DRFA
Added:
logging/log4cxx/trunk/src/main/include/log4cxx/rolling/rollingfileappenderskeleton.h
Modified:
logging/log4cxx/trunk/src/main/cpp/class.cpp
logging/log4cxx/trunk/src/main/cpp/dailyrollingfileappender.cpp
logging/log4cxx/trunk/src/main/cpp/obsoleterollingfileappender.cpp
logging/log4cxx/trunk/src/main/include/log4cxx/dailyrollingfileappender.h
logging/log4cxx/trunk/src/main/include/log4cxx/rolling/rollingfileappender.h
logging/log4cxx/trunk/src/main/include/log4cxx/rollingfileappender.h
Modified: logging/log4cxx/trunk/src/main/cpp/class.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/class.cpp?rev=628371&r1=628370&r2=628371&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/cpp/class.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/class.cpp Sat Feb 16 10:34:08 2008
@@ -25,6 +25,8 @@
#define LOG4CXX 1
#endif
#include <log4cxx/private/log4cxx_private.h>
+#include <log4cxx/rollingfileappender.h>
+#include <log4cxx/dailyrollingfileappender.h>
#include <log4cxx/asyncappender.h>
@@ -37,7 +39,6 @@
#endif
#include <log4cxx/nt/outputdebugstringappender.h>
#endif
-#include <log4cxx/rolling/rollingfileappender.h>
#include <log4cxx/net/smtpappender.h>
#include <log4cxx/net/socketappender.h>
#include <log4cxx/net/sockethubappender.h>
@@ -63,8 +64,6 @@
#include <log4cxx/rolling/sizebasedtriggeringpolicy.h>
#include <log4cxx/rolling/timebasedrollingpolicy.h>
-#include <log4cxx/rollingfileappender.h>
-#include <log4cxx/dailyrollingfileappender.h>
#include <log4cxx/xml/domconfigurator.h>
#include <log4cxx/propertyconfigurator.h>
#include <apr.h>
@@ -154,7 +153,7 @@
#endif
log4cxx::nt::OutputDebugStringAppender::registerClass();
#endif
- RollingFileAppender::registerClass();
+ log4cxx::RollingFileAppender::registerClass();
SMTPAppender::registerClass();
SocketAppender::registerClass();
#if APR_HAS_THREADS
Modified: logging/log4cxx/trunk/src/main/cpp/dailyrollingfileappender.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/dailyrollingfileappender.cpp?rev=628371&r1=628370&r2=628371&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/cpp/dailyrollingfileappender.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/dailyrollingfileappender.cpp Sat Feb 16 10:34:08 2008
@@ -32,7 +32,6 @@
DailyRollingFileAppender::DailyRollingFileAppender()
- : rfa(new log4cxx::rolling::RollingFileAppender())
{
}
@@ -41,22 +40,13 @@
const LayoutPtr& layout,
const LogString& filename,
const LogString& datePattern1)
- : datePattern(datePattern1),
- rfa(new log4cxx::rolling::RollingFileAppender()) {
- rfa->setLayout(layout);
- rfa->setFile(filename);
+ : datePattern(datePattern1) {
+ setLayout(layout);
+ setFile(filename);
Pool p;
activateOptions(p);
}
-void DailyRollingFileAppender::addRef() const {
- ObjectImpl::addRef();
-}
-
-void DailyRollingFileAppender::releaseRef() const {
- ObjectImpl::releaseRef();
-}
-
void DailyRollingFileAppender::setDatePattern(const LogString& pattern) {
datePattern = pattern;
}
@@ -67,7 +57,7 @@
void DailyRollingFileAppender::activateOptions(log4cxx::helpers::Pool& pool) {
TimeBasedRollingPolicyPtr policy = new TimeBasedRollingPolicy();
- LogString pattern(rfa->getFile());
+ LogString pattern(getFile());
bool inLiteral = false;
bool inPattern = false;
@@ -96,89 +86,12 @@
policy->setFileNamePattern(pattern);
policy->activateOptions(pool);
- rfa->setTriggeringPolicy(policy);
- rfa->setRollingPolicy(policy);
-
- rfa->activateOptions(pool);
-}
-
-void DailyRollingFileAppender::addFilter(const log4cxx::spi::FilterPtr& newFilter) {
- rfa->addFilter(newFilter);
-}
-
-log4cxx::spi::FilterPtr DailyRollingFileAppender::getFilter() const {
- return rfa->getFilter();
-}
-
-void DailyRollingFileAppender::clearFilters() {
- rfa->clearFilters();
-}
+ setTriggeringPolicy(policy);
+ setRollingPolicy(policy);
-void DailyRollingFileAppender::close() {
- rfa->close();
+ RollingFileAppenderSkeleton::activateOptions(pool);
}
-bool DailyRollingFileAppender::isClosed() const {
- return false;
-}
-
-bool DailyRollingFileAppender::isActive() const {
- return true;
-}
-
-void DailyRollingFileAppender::doAppend(const log4cxx::spi::LoggingEventPtr& event,
- log4cxx::helpers::Pool& pool) {
- rfa->doAppend(event, pool);
-}
-
-LogString DailyRollingFileAppender::getName() const {
- return rfa->getName();
-}
-
-void DailyRollingFileAppender::setLayout(const LayoutPtr& layout) {
- rfa->setLayout(layout);
-}
-
-LayoutPtr DailyRollingFileAppender::getLayout() const {
- return rfa->getLayout();
-}
-
-void DailyRollingFileAppender::setName(const LogString& name) {
- rfa->setName(name);
-}
-
-
-void DailyRollingFileAppender::setFile(const LogString& file) {
- rfa->setFile(file);
-}
-
-bool DailyRollingFileAppender::getAppend() const {
- return rfa->getAppend();
-}
-
-LogString DailyRollingFileAppender::getFile() const {
- return rfa->getFile();
-}
-
-bool DailyRollingFileAppender::getBufferedIO() const {
- return rfa->getBufferedIO();
-}
-
-int DailyRollingFileAppender::getBufferSize() const {
- return rfa->getBufferSize();
-}
-
-void DailyRollingFileAppender::setAppend(bool flag) {
- rfa->setAppend(flag);
-}
-
-void DailyRollingFileAppender::setBufferedIO(bool bufferedIO) {
- rfa->setBufferedIO(bufferedIO);
-}
-
-void DailyRollingFileAppender::setBufferSize(int bufferSize) {
- rfa->setBufferSize(bufferSize);
-}
void DailyRollingFileAppender::setOption(const LogString& option,
const LogString& value) {
@@ -186,21 +99,10 @@
LOG4CXX_STR("DATEPATTERN"), LOG4CXX_STR("datepattern"))) {
setDatePattern(value);
} else {
- rfa->setOption(option, value);
+ RollingFileAppenderSkeleton::setOption(option, value);
}
}
-void DailyRollingFileAppender::setErrorHandler(const spi::ErrorHandlerPtr& errorHandler) {
- rfa->setErrorHandler(errorHandler);
-}
-
-const spi::ErrorHandlerPtr& DailyRollingFileAppender::getErrorHandler() const {
- return rfa->getErrorHandler();
-}
-
-bool DailyRollingFileAppender::requiresLayout() const {
- return rfa->requiresLayout();
-}
Modified: logging/log4cxx/trunk/src/main/cpp/obsoleterollingfileappender.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/obsoleterollingfileappender.cpp?rev=628371&r1=628370&r2=628371&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/cpp/obsoleterollingfileappender.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/obsoleterollingfileappender.cpp Sat Feb 16 10:34:08 2008
@@ -20,7 +20,7 @@
#include <log4cxx/helpers/loglog.h>
#include <log4cxx/helpers/optionconverter.h>
#include <log4cxx/helpers/stringhelper.h>
-#include <log4cxx/rolling/rollingfileappender.h>
+#include <log4cxx/rolling/rollingfileappenderskeleton.h>
#include <log4cxx/rolling/sizebasedtriggeringpolicy.h>
#include <log4cxx/rolling/fixedwindowrollingpolicy.h>
@@ -107,7 +107,8 @@
}
else
{
- log4cxx::rolling::RollingFileAppenderSkeleton::setOption(option, value);
+ using namespace log4cxx::rolling;
+ RollingFileAppenderSkeleton::setOption(option, value);
}
}
@@ -147,7 +148,8 @@
rolling->activateOptions(pool);
setRollingPolicy(rolling);
- log4cxx::rolling::RollingFileAppenderSkeleton::activateOptions(pool);
+ using namespace log4cxx::rolling;
+ RollingFileAppenderSkeleton::activateOptions(pool);
}
Modified: logging/log4cxx/trunk/src/main/include/log4cxx/dailyrollingfileappender.h
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/include/log4cxx/dailyrollingfileappender.h?rev=628371&r1=628370&r2=628371&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/include/log4cxx/dailyrollingfileappender.h (original)
+++ logging/log4cxx/trunk/src/main/include/log4cxx/dailyrollingfileappender.h Sat Feb 16 10:34:08 2008
@@ -27,7 +27,7 @@
#include <log4cxx/appender.h>
#include <log4cxx/fileappender.h>
#include <log4cxx/spi/optionhandler.h>
-#include <log4cxx/rolling/rollingfileappender.h>
+#include <log4cxx/rolling/rollingfileappenderskeleton.h>
namespace log4cxx {
namespace helpers {
@@ -50,12 +50,11 @@
*
* @deprecated Replaced by {@link org.apache.log4j.rolling.RollingFileAppender}
*/
-class LOG4CXX_EXPORT DailyRollingFileAppender : public Appender, log4cxx::helpers::ObjectImpl {
+ class LOG4CXX_EXPORT DailyRollingFileAppender : public log4cxx::rolling::RollingFileAppenderSkeleton {
DECLARE_LOG4CXX_OBJECT(DailyRollingFileAppender)
BEGIN_LOG4CXX_CAST_MAP()
LOG4CXX_CAST_ENTRY(DailyRollingFileAppender)
- LOG4CXX_CAST_ENTRY(Appender)
- LOG4CXX_CAST_ENTRY(spi::OptionHandler)
+ LOG4CXX_CAST_ENTRY_CHAIN(FileAppender)
END_LOG4CXX_CAST_MAP()
/**
@@ -63,10 +62,6 @@
*/
LogString datePattern;
- /**
- * Nested new rolling file appender.
- */
- log4cxx::rolling::RollingFileAppenderPtr rfa;
public:
/**
@@ -85,8 +80,6 @@
const LogString& filename,
const LogString& datePattern);
- void addRef() const;
- void releaseRef() const;
/**
The <b>DatePattern</b> takes a string in the same format as
@@ -98,186 +91,13 @@
/** Returns the value of the <b>DatePattern</b> option. */
LogString getDatePattern();
+ void setOption(const LogString& option,
+ const LogString& value);
+
/**
* Prepares DailyRollingFileAppender for use.
*/
void activateOptions(log4cxx::helpers::Pool&);
-
- /**
- * Add a filter to the end of the filter list.
- *
- *
- */
- void addFilter(const log4cxx::spi::FilterPtr& newFilter);
-
- /**
- * Returns the head Filter. The Filters are organized in a linked list and
- * so all Filters on this Appender are available through the result.
- *
- * @return the head Filter or null, if no Filters are present
- *
- *
- */
- log4cxx::spi::FilterPtr getFilter() const;
-
- /**
- * Clear the list of filters by removing all the filters in it.
- *
- *
- */
- void clearFilters();
-
- /**
- * Release any resources allocated within the appender such as file handles,
- * network connections, etc.
- *
- * <p>
- * It is a programming error to append to a closed appender.
- * </p>
- *
- *
- */
- void close();
-
- /**
- * Is this appender closed?
- *
- *
- */
- bool isClosed() const;
-
- /**
- * Is this appender in working order?
- *
- *
- */
- bool isActive() const;
-
- /**
- * Log in <code>Appender</code> specific way. When appropriate, Loggers will
- * call the <code>doAppend</code> method of appender implementations in
- * order to log.
- */
- void doAppend(const log4cxx::spi::LoggingEventPtr& event, log4cxx::helpers::Pool&);
-
- /**
- * Get the name of this appender. The name uniquely identifies the appender.
- */
- LogString getName() const;
-
- /**
- * Set the {@link Layout} for this appender.
- *
- *
- */
- void setLayout(const LayoutPtr& layout);
-
- /**
- * Returns this appenders layout.
- *
- *
- */
- LayoutPtr getLayout() const;
-
- /**
- * Set the name of this appender. The name is used by other components to
- * identify this appender.
- *
- *
- */
- void setName(const LogString& name);
-
-
- /**
- The <b>File</b> property takes a string value which should be the
- name of the file to append to.
-
- <p><font color="#DD0044"><b>Note that the special values
- "System.out" or "System.err" are no longer honored.</b></font>
-
- <p>Note: Actual opening of the file is made when {@link
- #activateOptions} is called, not when the options are set. */
- void setFile(const LogString& file);
-
- /**
- Returns the value of the <b>Append</b> option.
- */
- bool getAppend() const;
-
- /** Returns the value of the <b>File</b> option. */
- LogString getFile() const;
-
- /**
- Get the value of the <b>BufferedIO</b> option.
-
- <p>BufferedIO will significatnly increase performance on heavily
- loaded systems.
-
- */
- bool getBufferedIO() const;
-
- /**
- Get the size of the IO buffer.
- */
- int getBufferSize() const;
-
- /**
- The <b>Append</b> option takes a boolean value. It is set to
- <code>true</code> by default. If true, then <code>File</code>
- will be opened in append mode by {@link #setFile setFile} (see
- above). Otherwise, {@link #setFile setFile} will open
- <code>File</code> in truncate mode.
-
- <p>Note: Actual opening of the file is made when {@link
- #activateOptions} is called, not when the options are set.
- */
- void setAppend(bool flag);
-
- /**
- The <b>BufferedIO</b> option takes a boolean value. It is set to
- <code>false</code> by default. If true, then <code>File</code>
- will be opened and the resulting {@link java.io.Writer} wrapped
- around a {@link java.io.BufferedWriter}.
-
- BufferedIO will significatnly increase performance on heavily
- loaded systems.
-
- */
- void setBufferedIO(bool bufferedIO);
-
- /**
- Set the size of the IO buffer.
- */
- void setBufferSize(int bufferSize);
-
- void setOption(const LogString&, const LogString&);
-
- /**
- Set the {@link spi::ErrorHandler ErrorHandler} for this appender.
- */
- void setErrorHandler(const spi::ErrorHandlerPtr& errorHandler);
-
- /**
- Returns the {@link spi::ErrorHandler ErrorHandler} for this appender.
- */
- const spi::ErrorHandlerPtr& getErrorHandler() const;
-
- /**
- Configurators call this method to determine if the appender
- requires a layout. If this method returns <code>true</code>,
- meaning that layout is required, then the configurator will
- configure an layout using the configuration information at its
- disposal. If this method returns <code>false</code>, meaning that
- a layout is not required, then layout configuration will be
- skipped even if there is available layout configuration
- information at the disposal of the configurator..
-
- <p>In the rather exceptional case, where the appender
- implementation admits a layout but can also work without it, then
- the appender should return <code>true</code>.
- */
- bool requiresLayout() const;
-
};
Modified: logging/log4cxx/trunk/src/main/include/log4cxx/rolling/rollingfileappender.h
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/include/log4cxx/rolling/rollingfileappender.h?rev=628371&r1=628370&r2=628371&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/include/log4cxx/rolling/rollingfileappender.h (original)
+++ logging/log4cxx/trunk/src/main/include/log4cxx/rolling/rollingfileappender.h Sat Feb 16 10:34:08 2008
@@ -18,134 +18,12 @@
#if !defined(_LOG4CXX_ROLLING_ROLLING_FILE_APPENDER_H)
#define _LOG4CXX_ROLLING_ROLLING_FILE_APPENDER_H
-#include <log4cxx/portability.h>
-#include <log4cxx/spi/optionhandler.h>
-#include <log4cxx/fileappender.h>
-#include <log4cxx/rolling/triggeringpolicy.h>
-#include <log4cxx/rolling/rollingpolicy.h>
-#include <log4cxx/rolling/action.h>
+#include <log4cxx/rolling/rollingfileappenderskeleton.h>
+
namespace log4cxx {
namespace rolling {
-
- /**
- * Base class for log4cxx::rolling::RollingFileAppender and log4cxx::RollingFileAppender
- * (analogues of org.apache.log4j.rolling.RFA from extras companion and
- * org.apache.log4j.RFA from log4j 1.2, respectively).
- *
- * */
- class LOG4CXX_EXPORT RollingFileAppenderSkeleton : public FileAppender {
- DECLARE_LOG4CXX_OBJECT(RollingFileAppenderSkeleton)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(RollingFileAppenderSkeleton)
- LOG4CXX_CAST_ENTRY_CHAIN(FileAppender)
- END_LOG4CXX_CAST_MAP()
-
- /**
- * Triggering policy.
- */
- TriggeringPolicyPtr triggeringPolicy;
-
- /**
- * Rolling policy.
- */
- RollingPolicyPtr rollingPolicy;
-
- /**
- * Length of current active log file.
- */
- size_t fileLength;
-
- /**
- * Asynchronous action (like compression) from previous rollover.
- */
- ActionPtr lastRolloverAsyncAction;
-
- public:
- /**
- * The default constructor simply calls its {@link
- * FileAppender#FileAppender parents constructor}.
- * */
- RollingFileAppenderSkeleton();
-
- void activateOptions(log4cxx::helpers::Pool&);
-
-
- /**
- Implements the usual roll over behaviour.
-
- <p>If <code>MaxBackupIndex</code> is positive, then files
- {<code>File.1</code>, ..., <code>File.MaxBackupIndex -1</code>}
- are renamed to {<code>File.2</code>, ...,
- <code>File.MaxBackupIndex</code>}. Moreover, <code>File</code> is
- renamed <code>File.1</code> and closed. A new <code>File</code> is
- created to receive further log output.
-
- <p>If <code>MaxBackupIndex</code> is equal to zero, then the
- <code>File</code> is truncated with no backup files created.
-
- */
- bool rollover(log4cxx::helpers::Pool& p);
-
- protected:
-
- /**
- Actual writing occurs here.
- */
- virtual void subAppend(const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& p);
-
- protected:
-
- RollingPolicyPtr getRollingPolicy() const;
-
- TriggeringPolicyPtr getTriggeringPolicy() const;
-
- /**
- * Sets the rolling policy. In case the 'policy' argument also implements
- * {@link TriggeringPolicy}, then the triggering policy for this appender
- * is automatically set to be the policy argument.
- * @param policy
- */
- void setRollingPolicy(const RollingPolicyPtr& policy);
-
- void setTriggeringPolicy(const TriggeringPolicyPtr& policy);
-
- public:
- /**
- * Close appender. Waits for any asynchronous file compression actions to be completed.
- */
- void close();
-
- protected:
- /**
- Returns an OutputStreamWriter when passed an OutputStream. The
- encoding used will depend on the value of the
- <code>encoding</code> property. If the encoding value is
- specified incorrectly the writer will be opened using the default
- system encoding (an error message will be printed to the loglog.
- @param os output stream, may not be null.
- @return new writer.
- */
- log4cxx::helpers::WriterPtr createWriter(log4cxx::helpers::OutputStreamPtr& os);
-
- public:
-
-
-
- /**
- * Get byte length of current active log file.
- * @return byte length of current active log file.
- */
- size_t getFileLength() const;
-
- /**
- * Increments estimated byte length of current active log file.
- * @param increment additional bytes written to log file.
- */
- void incrementFileLength(size_t increment);
-
- };
/**
* <code>RollingFileAppender</code> extends {@link FileAppender} to backup the log files
@@ -218,7 +96,6 @@
};
- LOG4CXX_PTR_DEF(RollingFileAppenderSkeleton)
LOG4CXX_PTR_DEF(RollingFileAppender)
}
Added: logging/log4cxx/trunk/src/main/include/log4cxx/rolling/rollingfileappenderskeleton.h
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/include/log4cxx/rolling/rollingfileappenderskeleton.h?rev=628371&view=auto
==============================================================================
--- logging/log4cxx/trunk/src/main/include/log4cxx/rolling/rollingfileappenderskeleton.h (added)
+++ logging/log4cxx/trunk/src/main/include/log4cxx/rolling/rollingfileappenderskeleton.h Sat Feb 16 10:34:08 2008
@@ -0,0 +1,157 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#if !defined(_LOG4CXX_ROLLING_ROLLING_FILE_APPENDER_SKELETON_H)
+#define _LOG4CXX_ROLLING_ROLLING_FILE_APPENDER_SKELETON_H
+
+#include <log4cxx/portability.h>
+#include <log4cxx/spi/optionhandler.h>
+#include <log4cxx/fileappender.h>
+#include <log4cxx/rolling/triggeringpolicy.h>
+#include <log4cxx/rolling/rollingpolicy.h>
+#include <log4cxx/rolling/action.h>
+
+namespace log4cxx {
+ namespace rolling {
+
+
+ /**
+ * Base class for log4cxx::rolling::RollingFileAppender and log4cxx::RollingFileAppender
+ * (analogues of org.apache.log4j.rolling.RFA from extras companion and
+ * org.apache.log4j.RFA from log4j 1.2, respectively).
+ *
+ * */
+ class LOG4CXX_EXPORT RollingFileAppenderSkeleton : public FileAppender {
+ DECLARE_LOG4CXX_OBJECT(RollingFileAppenderSkeleton)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(RollingFileAppenderSkeleton)
+ LOG4CXX_CAST_ENTRY_CHAIN(FileAppender)
+ END_LOG4CXX_CAST_MAP()
+
+ /**
+ * Triggering policy.
+ */
+ TriggeringPolicyPtr triggeringPolicy;
+
+ /**
+ * Rolling policy.
+ */
+ RollingPolicyPtr rollingPolicy;
+
+ /**
+ * Length of current active log file.
+ */
+ size_t fileLength;
+
+ /**
+ * Asynchronous action (like compression) from previous rollover.
+ */
+ ActionPtr lastRolloverAsyncAction;
+
+ public:
+ /**
+ * The default constructor simply calls its {@link
+ * FileAppender#FileAppender parents constructor}.
+ * */
+ RollingFileAppenderSkeleton();
+
+ void activateOptions(log4cxx::helpers::Pool&);
+
+
+ /**
+ Implements the usual roll over behaviour.
+
+ <p>If <code>MaxBackupIndex</code> is positive, then files
+ {<code>File.1</code>, ..., <code>File.MaxBackupIndex -1</code>}
+ are renamed to {<code>File.2</code>, ...,
+ <code>File.MaxBackupIndex</code>}. Moreover, <code>File</code> is
+ renamed <code>File.1</code> and closed. A new <code>File</code> is
+ created to receive further log output.
+
+ <p>If <code>MaxBackupIndex</code> is equal to zero, then the
+ <code>File</code> is truncated with no backup files created.
+
+ */
+ bool rollover(log4cxx::helpers::Pool& p);
+
+ protected:
+
+ /**
+ Actual writing occurs here.
+ */
+ virtual void subAppend(const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& p);
+
+ protected:
+
+ RollingPolicyPtr getRollingPolicy() const;
+
+ TriggeringPolicyPtr getTriggeringPolicy() const;
+
+ /**
+ * Sets the rolling policy. In case the 'policy' argument also implements
+ * {@link TriggeringPolicy}, then the triggering policy for this appender
+ * is automatically set to be the policy argument.
+ * @param policy
+ */
+ void setRollingPolicy(const RollingPolicyPtr& policy);
+
+ void setTriggeringPolicy(const TriggeringPolicyPtr& policy);
+
+ public:
+ /**
+ * Close appender. Waits for any asynchronous file compression actions to be completed.
+ */
+ void close();
+
+ protected:
+ /**
+ Returns an OutputStreamWriter when passed an OutputStream. The
+ encoding used will depend on the value of the
+ <code>encoding</code> property. If the encoding value is
+ specified incorrectly the writer will be opened using the default
+ system encoding (an error message will be printed to the loglog.
+ @param os output stream, may not be null.
+ @return new writer.
+ */
+ log4cxx::helpers::WriterPtr createWriter(log4cxx::helpers::OutputStreamPtr& os);
+
+ public:
+
+
+
+ /**
+ * Get byte length of current active log file.
+ * @return byte length of current active log file.
+ */
+ size_t getFileLength() const;
+
+ /**
+ * Increments estimated byte length of current active log file.
+ * @param increment additional bytes written to log file.
+ */
+ void incrementFileLength(size_t increment);
+
+ };
+
+
+ LOG4CXX_PTR_DEF(RollingFileAppenderSkeleton)
+
+ }
+}
+
+#endif
+
Modified: logging/log4cxx/trunk/src/main/include/log4cxx/rollingfileappender.h
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/include/log4cxx/rollingfileappender.h?rev=628371&r1=628370&r2=628371&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/include/log4cxx/rollingfileappender.h (original)
+++ logging/log4cxx/trunk/src/main/include/log4cxx/rollingfileappender.h Sat Feb 16 10:34:08 2008
@@ -22,7 +22,7 @@
#pragma warning ( disable: 4231 4251 4275 4786 )
#endif
-#include <log4cxx/rolling/rollingfileappender.h>
+#include <log4cxx/rolling/rollingfileappenderskeleton.h>
namespace log4cxx
{
@@ -44,7 +44,7 @@
DECLARE_LOG4CXX_OBJECT_WITH_CUSTOM_CLASS( RollingFileAppender, ClassRollingFileAppender )
BEGIN_LOG4CXX_CAST_MAP()
LOG4CXX_CAST_ENTRY( RollingFileAppender )
- LOG4CXX_CAST_ENTRY_CHAIN( log4cxx::rolling::RollingFileAppenderSkeleton )
+ LOG4CXX_CAST_ENTRY_CHAIN( FileAppender )
END_LOG4CXX_CAST_MAP()
/** The default constructor simply calls its {@link FileAppender#FileAppender parents constructor}. */
RollingFileAppender();