Author: carnold
Date: Tue Dec 12 12:59:07 2006
New Revision: 486308
URL: http://svn.apache.org/viewvc?view=rev&rev=486308
Log:
LOGCXX-136: DailyRollingFileAppender not using property options
Modified:
logging/log4cxx/trunk/include/log4cxx/dailyrollingfileappender.h
logging/log4cxx/trunk/include/log4cxx/rollingfileappender.h
logging/log4cxx/trunk/src/file.cpp
logging/log4cxx/trunk/tests/src/rolling/obsoletedailyrollingfileappendertest.cpp
logging/log4cxx/trunk/tests/src/rolling/obsoleterollingfileappendertest.cpp
Modified: logging/log4cxx/trunk/include/log4cxx/dailyrollingfileappender.h
URL:
http://svn.apache.org/viewvc/logging/log4cxx/trunk/include/log4cxx/dailyrollingfileappender.h?view=diff&rev=486308&r1=486307&r2=486308
==============================================================================
--- logging/log4cxx/trunk/include/log4cxx/dailyrollingfileappender.h (original)
+++ logging/log4cxx/trunk/include/log4cxx/dailyrollingfileappender.h Tue Dec 12
12:59:07 2006
@@ -52,6 +52,7 @@
BEGIN_LOG4CXX_CAST_MAP()
LOG4CXX_CAST_ENTRY(DailyRollingFileAppender)
LOG4CXX_CAST_ENTRY(Appender)
+ LOG4CXX_CAST_ENTRY(spi::OptionHandler)
END_LOG4CXX_CAST_MAP()
/**
Modified: logging/log4cxx/trunk/include/log4cxx/rollingfileappender.h
URL:
http://svn.apache.org/viewvc/logging/log4cxx/trunk/include/log4cxx/rollingfileappender.h?view=diff&rev=486308&r1=486307&r2=486308
==============================================================================
--- logging/log4cxx/trunk/include/log4cxx/rollingfileappender.h (original)
+++ logging/log4cxx/trunk/include/log4cxx/rollingfileappender.h Tue Dec 12
12:59:07 2006
@@ -58,6 +58,7 @@
BEGIN_LOG4CXX_CAST_MAP()
LOG4CXX_CAST_ENTRY( RollingFileAppender )
LOG4CXX_CAST_ENTRY( Appender )
+ LOG4CXX_CAST_ENTRY( spi::OptionHandler)
END_LOG4CXX_CAST_MAP()
/** The default constructor simply calls its [EMAIL PROTECTED]
FileAppender#FileAppender parents constructor}. */
RollingFileAppender();
Modified: logging/log4cxx/trunk/src/file.cpp
URL:
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/file.cpp?view=diff&rev=486308&r1=486307&r2=486308
==============================================================================
--- logging/log4cxx/trunk/src/file.cpp (original)
+++ logging/log4cxx/trunk/src/file.cpp Tue Dec 12 12:59:07 2006
@@ -130,8 +130,24 @@
}
-std::vector<LogString> File::list(Pool& /* p */ ) const {
- return std::vector<LogString>();
- //
- // TODO:
+std::vector<LogString> File::list(Pool& p) const {
+ apr_dir_t *dir;
+ apr_finfo_t entry;
+ std::vector<LogString> filenames;
+
+ apr_status_t stat = apr_dir_open(&dir,
+ convertBackSlashes(osName).c_str(),
+ (apr_pool_t*) p.getAPRPool());
+ if(stat == APR_SUCCESS) {
+ stat = apr_dir_read(&entry, APR_FINFO_DIRENT, dir);
+ while(stat == APR_SUCCESS) {
+ if (entry.name != NULL) {
+ LOG4CXX_DECODE_CHAR(filename, entry.name);
+ filenames.push_back(filename);
+ }
+ stat = apr_dir_read(&entry, APR_FINFO_DIRENT, dir);
+ }
+ stat = apr_dir_close(dir);
+ }
+ return filenames;
}
Modified:
logging/log4cxx/trunk/tests/src/rolling/obsoletedailyrollingfileappendertest.cpp
URL:
http://svn.apache.org/viewvc/logging/log4cxx/trunk/tests/src/rolling/obsoletedailyrollingfileappendertest.cpp?view=diff&rev=486308&r1=486307&r2=486308
==============================================================================
---
logging/log4cxx/trunk/tests/src/rolling/obsoletedailyrollingfileappendertest.cpp
(original)
+++
logging/log4cxx/trunk/tests/src/rolling/obsoletedailyrollingfileappendertest.cpp
Tue Dec 12 12:59:07 2006
@@ -132,6 +132,5 @@
}
};
-// TODO:
-//CPPUNIT_TEST_SUITE_REGISTRATION(ObsoleteDailyRollingFileAppenderTest);
+CPPUNIT_TEST_SUITE_REGISTRATION(ObsoleteDailyRollingFileAppenderTest);
Modified:
logging/log4cxx/trunk/tests/src/rolling/obsoleterollingfileappendertest.cpp
URL:
http://svn.apache.org/viewvc/logging/log4cxx/trunk/tests/src/rolling/obsoleterollingfileappendertest.cpp?view=diff&rev=486308&r1=486307&r2=486308
==============================================================================
--- logging/log4cxx/trunk/tests/src/rolling/obsoleterollingfileappendertest.cpp
(original)
+++ logging/log4cxx/trunk/tests/src/rolling/obsoleterollingfileappendertest.cpp
Tue Dec 12 12:59:07 2006
@@ -33,7 +33,6 @@
#include <log4cxx/helpers/stringhelper.h>
using namespace log4cxx;
- using namespace log4cxx::rolling;
using namespace log4cxx::xml;
using namespace log4cxx::filter;
using namespace log4cxx::helpers;
@@ -48,8 +47,9 @@
CPPUNIT_TEST_SUITE(ObsoleteRollingFileAppenderTest);
// TODO: Property configurator isn't able to distinguish between
// obsolete and o.a.l.rolling.RollingFileAppender
-// CPPUNIT_TEST(test1);
+// CPPUNIT_TEST(test1);
CPPUNIT_TEST(test2);
+ CPPUNIT_TEST(testIsOptionHandler);
CPPUNIT_TEST_SUITE_END();
@@ -126,6 +126,15 @@
CPPUNIT_ASSERT_EQUAL(true, File("output/obsoleteRFA-test2.log").exists(p));
CPPUNIT_ASSERT_EQUAL(true,
File("output/obsoleteRFA-test2.log.1").exists(p));
+ }
+
+ /**
+ * Tests if class is declared to support the OptionHandler interface.
+ * See LOGCXX-136.
+ */
+ void testIsOptionHandler() {
+ RollingFileAppenderPtr rfa(new RollingFileAppender());
+ CPPUNIT_ASSERT_EQUAL(true,
rfa->instanceof(log4cxx::spi::OptionHandler::getStaticClass()));
}
};