You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rm...@apache.org on 2021/11/06 00:43:21 UTC
[logging-log4cxx] 16/20: made sure that the rolling file appender
casts properly
This is an automated email from the ASF dual-hosted git repository.
rmiddleton pushed a commit to branch LOGCXX-510
in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git
commit 67b3cdfd60b74461216f61ed9a29a33146e734e4
Author: Robert Middleton <ro...@rm5248.com>
AuthorDate: Fri Nov 5 19:22:38 2021 -0400
made sure that the rolling file appender casts properly
---
src/main/include/log4cxx/rolling/rollingfileappender.h | 9 +++++----
src/test/cpp/helpers/casttestcase.cpp | 11 ++++++++++-
2 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/src/main/include/log4cxx/rolling/rollingfileappender.h b/src/main/include/log4cxx/rolling/rollingfileappender.h
index 4cb4240..c683b3f 100644
--- a/src/main/include/log4cxx/rolling/rollingfileappender.h
+++ b/src/main/include/log4cxx/rolling/rollingfileappender.h
@@ -78,10 +78,11 @@ namespace rolling
* */
class LOG4CXX_EXPORT RollingFileAppender : public FileAppender
{
- DECLARE_LOG4CXX_OBJECT(RollingFileAppender)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(RollingFileAppender)
- END_LOG4CXX_CAST_MAP()
+ DECLARE_LOG4CXX_OBJECT(RollingFileAppender)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(RollingFileAppender)
+ LOG4CXX_CAST_ENTRY_CHAIN(FileAppender)
+ END_LOG4CXX_CAST_MAP()
protected:
struct RollingFileAppenderPriv;
diff --git a/src/test/cpp/helpers/casttestcase.cpp b/src/test/cpp/helpers/casttestcase.cpp
index e7d8f53..8c66782 100644
--- a/src/test/cpp/helpers/casttestcase.cpp
+++ b/src/test/cpp/helpers/casttestcase.cpp
@@ -18,6 +18,7 @@
#include "../logunit.h"
#include <log4cxx/helpers/bytearrayoutputstream.h>
#include <log4cxx/helpers/fileoutputstream.h>
+#include <log4cxx/rolling/rollingfileappender.h>
#include <iostream>
using namespace log4cxx;
@@ -33,7 +34,7 @@ LOGUNIT_CLASS(CastTestCase)
LOGUNIT_TEST_SUITE( CastTestCase );
LOGUNIT_TEST(testGoodCast);
LOGUNIT_TEST(testBadCast);
-
+ LOGUNIT_TEST(testRollingFileAppender);
LOGUNIT_TEST_SUITE_END();
public:
@@ -59,6 +60,14 @@ public:
LOGUNIT_ASSERT(!fos);
}
+ void testRollingFileAppender(){
+ rolling::RollingFileAppenderPtr rolling = rolling::RollingFileAppenderPtr(new rolling::RollingFileAppender());
+
+ AppenderPtr appender = log4cxx::cast<Appender>(rolling);
+
+ LOGUNIT_ASSERT(appender);
+ }
+
};
LOGUNIT_TEST_SUITE_REGISTRATION(CastTestCase);