This is an automated email from the ASF dual-hosted git repository.
swebb2066 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git
The following commit(s) were added to refs/heads/master by this push:
new 66bc258a Use the argument-free activateOptions() syntax (#636)
66bc258a is described below
commit 66bc258a68fa30724f4501f9a2f591941cb192d9
Author: Stephen Webb <[email protected]>
AuthorDate: Sun Apr 26 10:26:02 2026 +1000
Use the argument-free activateOptions() syntax (#636)
* Require sub-class implementors to change ABI 15 code while allowing ABI
15 class interface users to use existing code
---
src/examples/cpp/custom-appender.cpp | 4 +
src/fuzzers/cpp/PatternLayoutFuzzer.cpp | 2 -
src/fuzzers/cpp/TimeBasedRollingPolicyFuzzer.cpp | 8 +-
src/main/cpp/appenderskeleton.cpp | 11 +-
src/main/cpp/consoleappender.cpp | 11 +-
src/main/cpp/dbappender.cpp | 3 +-
src/main/cpp/errorhandler.cpp | 11 +-
src/main/cpp/fallbackerrorhandler.cpp | 2 +
src/main/cpp/fileappender.cpp | 32 ++--
src/main/cpp/filter.cpp | 11 +-
src/main/cpp/filterbasedtriggeringpolicy.cpp | 4 +-
src/main/cpp/fixedwindowrollingpolicy.cpp | 4 +-
src/main/cpp/fmtlayout.cpp | 2 +-
src/main/cpp/jsonlayout.cpp | 2 +-
src/main/cpp/layout.cpp | 11 +-
src/main/cpp/manualtriggeringpolicy.cpp | 2 +-
src/main/cpp/multiprocessrollingfileappender.cpp | 11 +-
src/main/cpp/nteventlogappender.cpp | 5 +-
src/main/cpp/odbcappender.cpp | 2 +-
src/main/cpp/onlyonceerrorhandler.cpp | 2 +
src/main/cpp/optionhandler.cpp | 18 +-
src/main/cpp/patternlayout.cpp | 8 +-
src/main/cpp/propertysetter.cpp | 2 +-
src/main/cpp/rollingfileappender.cpp | 61 ++++---
src/main/cpp/rollingpolicybase.cpp | 21 +--
src/main/cpp/sizebasedtriggeringpolicy.cpp | 2 +-
src/main/cpp/smtpappender.cpp | 22 +--
src/main/cpp/socketappenderskeleton.cpp | 6 +-
src/main/cpp/syslogappender.cpp | 2 +
src/main/cpp/telnetappender.cpp | 2 +-
src/main/cpp/timebasedrollingpolicy.cpp | 12 +-
src/main/cpp/triggeringpolicy.cpp | 13 --
src/main/cpp/writerappender.cpp | 33 ++--
src/main/cpp/xmlsocketappender.cpp | 6 +-
src/main/include/log4cxx/appenderskeleton.h | 22 +--
src/main/include/log4cxx/consoleappender.h | 3 +-
src/main/include/log4cxx/db/dbappender.h | 2 +-
src/main/include/log4cxx/db/odbcappender.h | 2 +-
src/main/include/log4cxx/fileappender.h | 17 +-
src/main/include/log4cxx/filter/expressionfilter.h | 2 +-
src/main/include/log4cxx/fmtlayout.h | 5 +-
.../include/log4cxx/helpers/onlyonceerrorhandler.h | 3 +-
src/main/include/log4cxx/htmllayout.h | 5 +-
src/main/include/log4cxx/jsonlayout.h | 5 +-
src/main/include/log4cxx/layout.h | 13 +-
src/main/include/log4cxx/net/smtpappender.h | 2 +-
.../include/log4cxx/net/socketappenderskeleton.h | 3 +-
src/main/include/log4cxx/net/syslogappender.h | 3 +-
src/main/include/log4cxx/net/telnetappender.h | 3 +-
src/main/include/log4cxx/net/xmlsocketappender.h | 1 +
src/main/include/log4cxx/nt/nteventlogappender.h | 3 +-
src/main/include/log4cxx/patternlayout.h | 3 +-
.../log4cxx/private/rollingfileappender_priv.h | 2 +
.../log4cxx/private/rollingpolicybase_priv.h | 4 +
.../include/log4cxx/private/writerappender_priv.h | 2 +
.../log4cxx/rolling/filterbasedtriggeringpolicy.h | 5 +-
.../log4cxx/rolling/fixedwindowrollingpolicy.h | 3 +-
.../log4cxx/rolling/manualtriggeringpolicy.h | 5 +-
.../rolling/multiprocessrollingfileappender.h | 2 +-
.../include/log4cxx/rolling/rollingfileappender.h | 3 +-
.../include/log4cxx/rolling/rollingpolicybase.h | 16 +-
.../log4cxx/rolling/sizebasedtriggeringpolicy.h | 11 +-
.../log4cxx/rolling/timebasedrollingpolicy.h | 6 +-
.../include/log4cxx/rolling/triggeringpolicy.h | 9 -
src/main/include/log4cxx/simplelayout.h | 4 +-
src/main/include/log4cxx/spi/appenderattachable.h | 6 -
src/main/include/log4cxx/spi/errorhandler.h | 5 +-
src/main/include/log4cxx/spi/filter.h | 24 +--
src/main/include/log4cxx/spi/optionhandler.h | 24 ++-
.../include/log4cxx/varia/fallbackerrorhandler.h | 7 +-
src/main/include/log4cxx/writerappender.h | 3 +-
src/main/include/log4cxx/xml/xmllayout.h | 6 +-
src/site/doxy/Doxyfile.in | 4 +-
src/test/cpp/CMakeLists.txt | 1 +
src/test/cpp/asyncappendertestcase.cpp | 9 +-
src/test/cpp/benchmark/benchmark.cpp | 4 -
src/test/cpp/consoleappendertestcase.cpp | 3 +-
src/test/cpp/encodingtest.cpp | 5 +-
src/test/cpp/fileappendertest.cpp | 9 +-
src/test/cpp/filter/andfiltertest.cpp | 34 ++--
src/test/cpp/filter/denyallfiltertest.cpp | 3 +-
src/test/cpp/filter/levelmatchfiltertest.cpp | 15 +-
src/test/cpp/filter/levelrangefiltertest.cpp | 18 +-
src/test/cpp/filter/locationinfofiltertest.cpp | 12 +-
src/test/cpp/filter/loggermatchfiltertest.cpp | 12 +-
src/test/cpp/filter/mapfiltertest.cpp | 12 +-
src/test/cpp/filter/stringmatchfiltertest.cpp | 15 +-
src/test/cpp/multithreadtest.cpp | 3 +-
src/test/cpp/net/socketappendertestcase.cpp | 3 +-
src/test/cpp/net/telnetappendertestcase.cpp | 12 +-
src/test/cpp/nt/nteventlogappendertestcase.cpp | 2 +-
src/test/cpp/optionhandlertest.cpp | 184 +++++++++++++++++++++
src/test/cpp/patternlayouttest.cpp | 23 ++-
src/test/cpp/rolling/filterbasedrollingtest.cpp | 7 +-
src/test/cpp/rolling/manualrollingtest.cpp | 31 ++--
.../rolling/rollingfileappenderpropertiestest.cpp | 6 +-
src/test/cpp/rolling/sizebasedrollingtest.cpp | 31 ++--
src/test/cpp/rolling/timebasedrollingtest.cpp | 50 +++---
src/test/cpp/throughput/log4cxxbenchmarker.cpp | 5 -
src/test/cpp/varia/errorhandlertestcase.cpp | 6 +-
src/test/cpp/xml/xmllayouttest.cpp | 3 +-
101 files changed, 581 insertions(+), 533 deletions(-)
diff --git a/src/examples/cpp/custom-appender.cpp
b/src/examples/cpp/custom-appender.cpp
index 3525b535..598abeca 100644
--- a/src/examples/cpp/custom-appender.cpp
+++ b/src/examples/cpp/custom-appender.cpp
@@ -44,7 +44,11 @@ public:
// This gets called whenever there is a valid event for our
appender.
}
+#if LOG4CXX_ABI_VERSION <= 15
void activateOptions(helpers::Pool& /* pool */) override {
+#else
+ void activateOptions() override {
+#endif
// Given all of our options, do something useful(e.g. open a
file)
}
diff --git a/src/fuzzers/cpp/PatternLayoutFuzzer.cpp
b/src/fuzzers/cpp/PatternLayoutFuzzer.cpp
index 62c7c07f..d0e6db31 100644
--- a/src/fuzzers/cpp/PatternLayoutFuzzer.cpp
+++ b/src/fuzzers/cpp/PatternLayoutFuzzer.cpp
@@ -58,8 +58,6 @@ public:
getLayout()->format(msg, event, pool);
}
- void activateOptions(helpers::Pool& pool) override {}
-
void setOption(const LogString& option, const LogString& value)
override {}
}; // class
diff --git a/src/fuzzers/cpp/TimeBasedRollingPolicyFuzzer.cpp
b/src/fuzzers/cpp/TimeBasedRollingPolicyFuzzer.cpp
index a1d92b91..ac65a1c6 100644
--- a/src/fuzzers/cpp/TimeBasedRollingPolicyFuzzer.cpp
+++ b/src/fuzzers/cpp/TimeBasedRollingPolicyFuzzer.cpp
@@ -34,7 +34,6 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data,
size_t size) {
FuzzedDataProvider fdp(data, size);
// Set up logger
- Pool pool;
PatternLayoutPtr layout( new PatternLayout(PATTERN_LAYOUT));
RollingFileAppenderPtr rfa( new RollingFileAppender());
rfa->setAppend(fdp.ConsumeBool());
@@ -49,15 +48,16 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data,
size_t size) {
}
rfa->setFile(LOG4CXX_STR("test.log"));
- tbrp->activateOptions(pool);
+ tbrp->activateOptions();
rfa->setRollingPolicy(tbrp);
- rfa->activateOptions(pool);
+ rfa->activateOptions();
rfa->setBufferedSeconds(fdp.ConsumeIntegral<int>());
- rfa->activateOptions(pool);
+ rfa->activateOptions();
LoggerPtr logger =
LogManager::getLogger("org.apache.log4j.TimeBasedRollingTest");
logger->addAppender(rfa);
// Log and rollover
+ Pool pool;
for (int i = 0; i < 10; i++)
{
if (i == 4 || i == 9)
diff --git a/src/main/cpp/appenderskeleton.cpp
b/src/main/cpp/appenderskeleton.cpp
index 1297f3a4..030c7572 100644
--- a/src/main/cpp/appenderskeleton.cpp
+++ b/src/main/cpp/appenderskeleton.cpp
@@ -50,19 +50,10 @@ AppenderSkeleton::AppenderSkeleton(const LayoutPtr& layout)
AppenderSkeleton::~AppenderSkeleton() {}
-void AppenderSkeleton::activateOptions(helpers::Pool& /* pool */)
+void AppenderSkeleton::activateOptions(
LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS )
{
}
-#if 15 < LOG4CXX_ABI_VERSION
-void AppenderSkeleton::activateOptions()
-{
- // Ensure any ABI 15 overriden activateOptions is invoked
- helpers::Pool p;
- activateOptions(p);
-}
-#endif
-
#if LOG4CXX_ABI_VERSION <= 15
void AppenderSkeleton::finalize()
{
diff --git a/src/main/cpp/consoleappender.cpp b/src/main/cpp/consoleappender.cpp
index 87d0a007..40d7165d 100644
--- a/src/main/cpp/consoleappender.cpp
+++ b/src/main/cpp/consoleappender.cpp
@@ -49,9 +49,8 @@ ConsoleAppender::ConsoleAppender(const LayoutPtr& layout)
: WriterAppender (std::make_unique<ConsoleAppenderPriv>(getSystemOut()))
{
setLayout(layout);
- Pool p;
_priv->setWriter(std::make_shared<SystemOutWriter>());
- WriterAppender::activateOptions(p);
+ _priv->activateOptions();
}
ConsoleAppender::ConsoleAppender(const LayoutPtr& layout, const LogString&
target)
@@ -59,8 +58,12 @@ ConsoleAppender::ConsoleAppender(const LayoutPtr& layout,
const LogString& targe
{
setLayout(layout);
setTarget(target);
+#if LOG4CXX_ABI_VERSION <= 15
Pool p;
ConsoleAppender::activateOptions(p);
+#else
+ ConsoleAppender::activateOptions();
+#endif
}
ConsoleAppender::~ConsoleAppender()
@@ -111,7 +114,7 @@ void ConsoleAppender::targetWarn(const LogString& val)
LogLog::warn(LOG4CXX_STR("Using previously set target, System.out by
default."));
}
-void ConsoleAppender::activateOptions(Pool& p)
+void ConsoleAppender::activateOptions(
LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS )
{
if (StringHelper::equalsIgnoreCase(_priv->target,
LOG4CXX_STR("SYSTEM.OUT"), LOG4CXX_STR("system.out")))
@@ -124,7 +127,7 @@ void ConsoleAppender::activateOptions(Pool& p)
_priv->setWriter(std::make_shared<SystemErrWriter>());
}
- WriterAppender::activateOptions(p);
+ _priv->activateOptions();
}
void ConsoleAppender::setOption(const LogString& option, const LogString&
value)
diff --git a/src/main/cpp/dbappender.cpp b/src/main/cpp/dbappender.cpp
index ed3582c2..971b7f21 100644
--- a/src/main/cpp/dbappender.cpp
+++ b/src/main/cpp/dbappender.cpp
@@ -154,7 +154,8 @@ void DBAppender::setOption(const LogString& option, const
LogString& value){
}
}
-void DBAppender::activateOptions(helpers::Pool& p){
+void DBAppender::activateOptions( LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS )
+{
apr_status_t stat = apr_dbd_get_driver(_priv->m_pool.getAPRPool(),
_priv->driverName.c_str(),
#if 15 < LOG4CXX_ABI_VERSION
diff --git a/src/main/cpp/errorhandler.cpp b/src/main/cpp/errorhandler.cpp
index 94a0f078..001efd01 100644
--- a/src/main/cpp/errorhandler.cpp
+++ b/src/main/cpp/errorhandler.cpp
@@ -20,14 +20,7 @@ using namespace LOG4CXX_NS;
using namespace LOG4CXX_NS::helpers;
#if 15 < LOG4CXX_ABI_VERSION
-void spi::ErrorHandler::activateOptions(Pool&)
+void spi::ErrorHandler::activateOptions(
LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS )
{
}
-
-void spi::ErrorHandler::activateOptions()
-{
- // Ensure any ABI 15 overriden activateOptions is invoked
- helpers::Pool p;
- activateOptions(p);
-}
-#endif
\ No newline at end of file
+#endif
diff --git a/src/main/cpp/fallbackerrorhandler.cpp
b/src/main/cpp/fallbackerrorhandler.cpp
index f821b6aa..0c027c00 100644
--- a/src/main/cpp/fallbackerrorhandler.cpp
+++ b/src/main/cpp/fallbackerrorhandler.cpp
@@ -169,9 +169,11 @@ void FallbackErrorHandler::setBackupAppender(const
AppenderPtr& backup1)
m_priv->backup.push_back(backup1);
}
+#if LOG4CXX_ABI_VERSION <= 15
void FallbackErrorHandler::activateOptions(Pool&)
{
}
+#endif
void FallbackErrorHandler::setOption(const LogString&, const LogString&)
{
diff --git a/src/main/cpp/fileappender.cpp b/src/main/cpp/fileappender.cpp
index ae7a83dc..9e0233ce 100644
--- a/src/main/cpp/fileappender.cpp
+++ b/src/main/cpp/fileappender.cpp
@@ -52,8 +52,7 @@ FileAppender::FileAppender
)
: WriterAppender(std::make_unique<FileAppenderPriv>(layout1, fileName1,
append1, bufferedIO1, bufferSize1))
{
- Pool p;
- activateOptions(p);
+ activateOptionsInternal();
}
FileAppender::FileAppender
@@ -63,15 +62,13 @@ FileAppender::FileAppender
)
: WriterAppender(std::make_unique<FileAppenderPriv>(layout1, fileName1,
append1, false))
{
- Pool p;
- activateOptions(p);
+ activateOptionsInternal();
}
FileAppender::FileAppender(const LayoutPtr& layout1, const LogString&
fileName1)
: WriterAppender(std::make_unique<FileAppenderPriv>(layout1, fileName1))
{
- Pool p;
- activateOptions(p);
+ activateOptionsInternal();
}
FileAppender::FileAppender(std::unique_ptr<FileAppenderPriv> priv)
@@ -153,13 +150,13 @@ void FileAppender::setOption(const LogString& option,
}
}
-void FileAppender::activateOptions(Pool& p)
+void FileAppender::activateOptions( LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS
)
{
std::lock_guard<std::recursive_mutex> lock(_priv->mutex);
- activateOptionsInternal(p);
+ activateOptionsInternal();
}
-void FileAppender::activateOptionsInternal(Pool& p)
+void FileAppender::activateOptionsInternal()
{
int errors = 0;
@@ -167,7 +164,7 @@ void FileAppender::activateOptionsInternal(Pool& p)
{
try
{
- setFileInternal(_priv->fileName, _priv->fileAppend,
_priv->bufferedIO, _priv->bufferSize, p);
+ setFileInternal(_priv->fileName, _priv->fileAppend,
_priv->bufferedIO, _priv->bufferSize);
}
catch (IOException& e)
{
@@ -190,7 +187,7 @@ void FileAppender::activateOptionsInternal(Pool& p)
if (errors == 0)
{
- WriterAppender::activateOptions(p);
+ _priv->activateOptions();
if (auto p = _priv->taskManager.lock())
p->value().removePeriodicTask(getName());
@@ -287,8 +284,7 @@ void FileAppender::setFileInternal(
const LogString& filename,
bool append1,
bool bufferedIO1,
- size_t bufferSize1,
- Pool& p)
+ size_t bufferSize1)
{
// It does not make sense to have immediate flush and bufferedIO.
if (bufferedIO1)
@@ -354,6 +350,7 @@ void FileAppender::setFileInternal(
//
if (writeBOM)
{
+ Pool p;
char bom[] = { (char) 0xFE, (char) 0xFF };
ByteBuffer buf(bom, 2);
outStream->write(buf, p);
@@ -410,3 +407,12 @@ bool FileAppender::getAppend() const
{
return _priv->fileAppend;
}
+
+#if LOG4CXX_ABI_VERSION <= 15
+void FileAppender::activateOptionsInternal(helpers::Pool& )
+{ activateOptionsInternal(); }
+void FileAppender::setFileInternal(const LogString& file, bool append,
+ bool bufferedIO, size_t bufferSize,
+ helpers::Pool&)
+{ setFileInternal(file, append, bufferedIO, bufferSize); }
+#endif
diff --git a/src/main/cpp/filter.cpp b/src/main/cpp/filter.cpp
index 4507458c..39e63a8d 100644
--- a/src/main/cpp/filter.cpp
+++ b/src/main/cpp/filter.cpp
@@ -45,19 +45,10 @@ void Filter::setNext(const FilterPtr& newNext)
m_priv->next = newNext;
}
-void Filter::activateOptions(Pool&)
+void Filter::activateOptions( LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS )
{
}
-#if 15 < LOG4CXX_ABI_VERSION
-void Filter::activateOptions()
-{
- // Ensure any ABI 15 overriden activateOptions is invoked
- helpers::Pool p;
- activateOptions(p);
-}
-#endif
-
void Filter::setOption(const LogString&, const LogString&)
{
}
diff --git a/src/main/cpp/filterbasedtriggeringpolicy.cpp
b/src/main/cpp/filterbasedtriggeringpolicy.cpp
index ca7131cd..4a52aac5 100644
--- a/src/main/cpp/filterbasedtriggeringpolicy.cpp
+++ b/src/main/cpp/filterbasedtriggeringpolicy.cpp
@@ -111,11 +111,11 @@ LOG4CXX_NS::spi::FilterPtr&
FilterBasedTriggeringPolicy::getFilter()
/**
* Prepares the instance for use.
*/
-void FilterBasedTriggeringPolicy::activateOptions(LOG4CXX_NS::helpers::Pool& p)
+void FilterBasedTriggeringPolicy::activateOptions(
LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS )
{
for (LOG4CXX_NS::spi::FilterPtr f = m_priv->headFilter; f != NULL; f =
f->getNext())
{
- f->activateOptions(p);
+ f->activateOptions();
}
}
diff --git a/src/main/cpp/fixedwindowrollingpolicy.cpp
b/src/main/cpp/fixedwindowrollingpolicy.cpp
index 53a85c15..89aec4c6 100644
--- a/src/main/cpp/fixedwindowrollingpolicy.cpp
+++ b/src/main/cpp/fixedwindowrollingpolicy.cpp
@@ -99,9 +99,9 @@ void FixedWindowRollingPolicy::setOption(const LogString&
option,
/**
* {@inheritDoc}
*/
-void FixedWindowRollingPolicy::activateOptions(Pool& p)
+void FixedWindowRollingPolicy::activateOptions(
LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS )
{
- RollingPolicyBase::activateOptions(p);
+ priv->activateOptions(getFormatSpecifiers());
if (priv->maxIndex < priv->minIndex)
{
diff --git a/src/main/cpp/fmtlayout.cpp b/src/main/cpp/fmtlayout.cpp
index e6c5bf77..410a1dd1 100644
--- a/src/main/cpp/fmtlayout.cpp
+++ b/src/main/cpp/fmtlayout.cpp
@@ -80,7 +80,7 @@ void FMTLayout::setOption(const LogString& option, const
LogString& value)
}
}
-void FMTLayout::activateOptions(helpers::Pool&)
+void FMTLayout::activateOptions( LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS )
{
m_priv->expectedPatternLength = getFormattedEventCharacterCount() * 2;
}
diff --git a/src/main/cpp/jsonlayout.cpp b/src/main/cpp/jsonlayout.cpp
index c5c4df58..ac1467e4 100644
--- a/src/main/cpp/jsonlayout.cpp
+++ b/src/main/cpp/jsonlayout.cpp
@@ -104,7 +104,7 @@ LogString JSONLayout::getContentType() const
return LOG4CXX_STR("application/json");
}
-void JSONLayout::activateOptions(helpers::Pool& /* p */)
+void JSONLayout::activateOptions( LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS )
{
m_priv->expectedPatternLength = getFormattedEventCharacterCount() * 2;
}
diff --git a/src/main/cpp/layout.cpp b/src/main/cpp/layout.cpp
index dedef5d7..c500907f 100644
--- a/src/main/cpp/layout.cpp
+++ b/src/main/cpp/layout.cpp
@@ -52,14 +52,7 @@ size_t Layout::getFormattedEventCharacterCount() const
}
#if 15 < LOG4CXX_ABI_VERSION
-void Layout::activateOptions(Pool&)
+void Layout::activateOptions( LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS )
{
}
-
-void Layout::activateOptions()
-{
- // Ensure any ABI 15 overriden activateOptions is invoked
- Pool p;
- activateOptions(p);
-}
-#endif
\ No newline at end of file
+#endif
diff --git a/src/main/cpp/manualtriggeringpolicy.cpp
b/src/main/cpp/manualtriggeringpolicy.cpp
index eeb9ef1e..1fff5242 100644
--- a/src/main/cpp/manualtriggeringpolicy.cpp
+++ b/src/main/cpp/manualtriggeringpolicy.cpp
@@ -37,7 +37,7 @@ bool ManualTriggeringPolicy::isTriggeringEvent(Appender* /*
appender */,
return false;
}
-void ManualTriggeringPolicy::activateOptions(Pool& /* p */ )
+void ManualTriggeringPolicy::activateOptions(
LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS )
{
}
diff --git a/src/main/cpp/multiprocessrollingfileappender.cpp
b/src/main/cpp/multiprocessrollingfileappender.cpp
index 3c412372..71f16253 100644
--- a/src/main/cpp/multiprocessrollingfileappender.cpp
+++ b/src/main/cpp/multiprocessrollingfileappender.cpp
@@ -150,9 +150,12 @@
MultiprocessRollingFileAppender::MultiprocessRollingFileAppender()
/**
* Prepare instance of use.
*/
-void MultiprocessRollingFileAppender::activateOptions(Pool& p)
+void MultiprocessRollingFileAppender::activateOptions(
LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS )
{
- RollingFileAppender::activateOptions(p);
+ if (_priv->activateOptions())
+ {
+ FileAppender::activateOptionsInternal();
+ }
if (auto pTimeBased =
LOG4CXX_NS::cast<TimeBasedRollingPolicy>(_priv->rollingPolicy))
pTimeBased->setMultiprocess(true);
@@ -315,13 +318,13 @@ bool
MultiprocessRollingFileAppender::synchronizedRollover(Pool& p, const Trigge
msg.append(LOG4CXX_STR("] failed"));
_priv->errorHandler->error(msg);
}
- setFileInternal(rollover1->getActiveFileName(),
appendToExisting, _priv->bufferedIO, _priv->bufferSize, p);
+ setFileInternal(rollover1->getActiveFileName(),
appendToExisting, _priv->bufferedIO, _priv->bufferSize);
}
else
{
setFileInternal(rollover1->getActiveFileName());
// Call activateOptions to create any
intermediate directories(if required)
- FileAppender::activateOptionsInternal(p);
+ FileAppender::activateOptionsInternal();
OutputStreamPtr os =
std::make_shared<FileOutputStream>
( rollover1->getActiveFileName()
, rollover1->getAppend()
diff --git a/src/main/cpp/nteventlogappender.cpp
b/src/main/cpp/nteventlogappender.cpp
index ea4b552c..c6bff171 100644
--- a/src/main/cpp/nteventlogappender.cpp
+++ b/src/main/cpp/nteventlogappender.cpp
@@ -120,11 +120,10 @@ NTEventLogAppender::NTEventLogAppender() :
NTEventLogAppender::NTEventLogAppender(const LogString& server, const
LogString& log, const LogString& source, const LayoutPtr& layout)
:
AppenderSkeleton(std::make_unique<NTEventLogAppenderPrivate>(layout))
{
- Pool pool;
priv->server = server;
priv->log = log;
priv->source = source;
- activateOptions(pool);
+ activateOptions();
}
NTEventLogAppender::~NTEventLogAppender()
@@ -175,7 +174,7 @@ void NTEventLogAppender::setOption(const LogString& option,
const LogString& val
}
}
-void NTEventLogAppender::activateOptions(Pool&)
+void NTEventLogAppender::activateOptions(
LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS )
{
if (priv->source.empty())
{
diff --git a/src/main/cpp/odbcappender.cpp b/src/main/cpp/odbcappender.cpp
index eb58666b..fcad8cd2 100644
--- a/src/main/cpp/odbcappender.cpp
+++ b/src/main/cpp/odbcappender.cpp
@@ -218,7 +218,7 @@ bool ODBCAppender::requiresLayout() const
return false;
}
-void ODBCAppender::activateOptions(LOG4CXX_NS::helpers::Pool&)
+void ODBCAppender::activateOptions( LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS
)
{
#if !LOG4CXX_HAVE_ODBC
LogLog::error(LOG4CXX_STR("Can not activate ODBCAppender unless
compiled with ODBC support."));
diff --git a/src/main/cpp/onlyonceerrorhandler.cpp
b/src/main/cpp/onlyonceerrorhandler.cpp
index ebc07abd..b0944991 100644
--- a/src/main/cpp/onlyonceerrorhandler.cpp
+++ b/src/main/cpp/onlyonceerrorhandler.cpp
@@ -41,9 +41,11 @@ void OnlyOnceErrorHandler::setLogger(const LoggerPtr&)
{
}
+#if LOG4CXX_ABI_VERSION <= 15
void OnlyOnceErrorHandler::activateOptions(Pool&)
{
}
+#endif
void OnlyOnceErrorHandler::setOption(const LogString&, const LogString&)
{
diff --git a/src/main/cpp/optionhandler.cpp b/src/main/cpp/optionhandler.cpp
index 54be38e9..936cccdd 100644
--- a/src/main/cpp/optionhandler.cpp
+++ b/src/main/cpp/optionhandler.cpp
@@ -18,16 +18,18 @@
#include <log4cxx/helpers/pool.h>
using namespace LOG4CXX_NS;
-using namespace LOG4CXX_NS::helpers;
-
-void spi::OptionHandler::activateOptions(Pool&)
-{
-}
+#if LOG4CXX_ABI_VERSION <= 15
void spi::OptionHandler::activateOptions()
{
// Ensure any ABI 15 overriden activateOptions is invoked
- helpers::Pool p;
- activateOptions(p);
+ helpers::Pool p;
+ activateOptions(p);
}
-
+#else
+void spi::OptionHandler::activateOptions(helpers::Pool&)
+{
+ // Redirect to the ABI 16 activateOptions
+ activateOptions();
+}
+#endif
diff --git a/src/main/cpp/patternlayout.cpp b/src/main/cpp/patternlayout.cpp
index 6a29183d..9fdc0034 100644
--- a/src/main/cpp/patternlayout.cpp
+++ b/src/main/cpp/patternlayout.cpp
@@ -100,8 +100,7 @@ Constructs a PatternLayout using the supplied conversion
pattern.
PatternLayout::PatternLayout(const LogString& pattern) :
m_priv(std::make_unique<PatternLayoutPrivate>(pattern))
{
- Pool pool;
- activateOptions(pool);
+ activateOptions();
}
PatternLayout::~PatternLayout() {}
@@ -109,8 +108,7 @@ PatternLayout::~PatternLayout() {}
void PatternLayout::setConversionPattern(const LogString& pattern)
{
m_priv->conversionPattern = pattern;
- Pool pool;
- activateOptions(pool);
+ activateOptions();
}
void PatternLayout::format(LogString& output,
@@ -170,7 +168,7 @@ void PatternLayout::setOption(const LogString& option,
const LogString& value)
}
}
-void PatternLayout::activateOptions(Pool&)
+void PatternLayout::activateOptions(
LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS )
{
LogString pat(m_priv->conversionPattern);
diff --git a/src/main/cpp/propertysetter.cpp b/src/main/cpp/propertysetter.cpp
index bc1a028b..e8866669 100644
--- a/src/main/cpp/propertysetter.cpp
+++ b/src/main/cpp/propertysetter.cpp
@@ -104,6 +104,6 @@ void PropertySetter::activate(Pool& p)
if (obj != 0 && obj->instanceof(OptionHandler::getStaticClass()))
{
OptionHandlerPtr handler = LOG4CXX_NS::cast<OptionHandler>(obj);
- handler->activateOptions(p);
+ handler->activateOptions();
}
}
diff --git a/src/main/cpp/rollingfileappender.cpp
b/src/main/cpp/rollingfileappender.cpp
index b9b38bab..463628ad 100644
--- a/src/main/cpp/rollingfileappender.cpp
+++ b/src/main/cpp/rollingfileappender.cpp
@@ -175,46 +175,56 @@ void RollingFileAppender::setDatePattern(const LogString&
newPattern)
/**
* Prepare instance of use.
*/
-void RollingFileAppender::activateOptions(Pool& p)
+void RollingFileAppender::activateOptions(
LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS )
{
- if (!_priv->rollingPolicy)
+ if (_priv->activateOptions())
+ {
+ FileAppender::activateOptionsInternal();
+ }
+}
+
+bool RollingFileAppender::RollingFileAppenderPriv::activateOptions()
+{
+ bool result = false;
+ if (!this->rollingPolicy)
{
LogLog::warn(LOG4CXX_STR("No rolling policy configured for the
appender named [")
- + _priv->name + LOG4CXX_STR("]."));
+ + this->name + LOG4CXX_STR("]."));
auto fwrp = std::make_shared<FixedWindowRollingPolicy>();
- fwrp->setFileNamePattern(getFile() + LOG4CXX_STR(".%i"));
- _priv->rollingPolicy = fwrp;
+ fwrp->setFileNamePattern(this->fileName + LOG4CXX_STR(".%i"));
+ this->rollingPolicy = fwrp;
}
//
// if no explicit triggering policy and rolling policy is both.
//
- if (!_priv->triggeringPolicy)
+ if (!this->triggeringPolicy)
{
- TriggeringPolicyPtr trig =
LOG4CXX_NS::cast<TriggeringPolicy>(_priv->rollingPolicy);
+ TriggeringPolicyPtr trig =
LOG4CXX_NS::cast<TriggeringPolicy>(this->rollingPolicy);
if (trig != NULL)
{
- _priv->triggeringPolicy = trig;
+ this->triggeringPolicy = trig;
}
}
- if (!_priv->triggeringPolicy)
+ if (!this->triggeringPolicy)
{
LogLog::warn(LOG4CXX_STR("No triggering policy configured for
the appender named [")
- + _priv->name + LOG4CXX_STR("]."));
- _priv->triggeringPolicy =
std::make_shared<SizeBasedTriggeringPolicy>();
+ + this->name + LOG4CXX_STR("]."));
+ this->triggeringPolicy =
std::make_shared<SizeBasedTriggeringPolicy>();
}
{
- std::lock_guard<std::recursive_mutex> lock(_priv->mutex);
- _priv->triggeringPolicy->activateOptions(p);
- _priv->rollingPolicy->activateOptions(p);
+ std::lock_guard<std::recursive_mutex> lock(this->mutex);
+ this->triggeringPolicy->activateOptions();
+ this->rollingPolicy->activateOptions();
+ Pool p;
try
{
RolloverDescriptionPtr rollover1 =
- _priv->rollingPolicy->initialize(getFile(),
getAppend(), p);
+ this->rollingPolicy->initialize(this->fileName,
this->fileAppend, p);
if (rollover1 != NULL)
{
@@ -225,8 +235,8 @@ void RollingFileAppender::activateOptions(Pool& p)
syncAction->execute(p);
}
- _priv->fileName =
rollover1->getActiveFileName();
- _priv->fileAppend = rollover1->getAppend();
+ this->fileName = rollover1->getActiveFileName();
+ this->fileAppend = rollover1->getAppend();
//
// async action not yet implemented
@@ -240,24 +250,25 @@ void RollingFileAppender::activateOptions(Pool& p)
}
File activeFile;
- activeFile.setPath(getFile());
+ activeFile.setPath(this->fileName);
- if (getAppend())
+ if (this->fileAppend)
{
- _priv->fileLength = activeFile.length();
+ this->fileLength = activeFile.length();
}
else
{
- _priv->fileLength = 0;
+ this->fileLength = 0;
}
- FileAppender::activateOptionsInternal(p);
+ result = true;
}
catch (std::exception& ex)
{
- LogLog::warn(LOG4CXX_STR("Exception activating
RollingFileAppender ") + getName(), ex);
+ LogLog::warn(LOG4CXX_STR("Exception activating
RollingFileAppender ") + this->fileName, ex);
}
}
+ return result;
}
/**
@@ -349,14 +360,14 @@ bool RollingFileAppender::rolloverInternal(Pool& p)
}
}
}
-
setFileInternal(rollover1->getActiveFileName(), appendToExisting,
_priv->bufferedIO, _priv->bufferSize, p);
+
setFileInternal(rollover1->getActiveFileName(), appendToExisting,
_priv->bufferedIO, _priv->bufferSize);
}
else
{
_priv->close();
setFileInternal(rollover1->getActiveFileName());
// Call activateOptions
to create any intermediate directories(if required)
-
FileAppender::activateOptionsInternal(p);
+
FileAppender::activateOptionsInternal();
OutputStreamPtr os =
std::make_shared<FileOutputStream>
(
rollover1->getActiveFileName()
,
rollover1->getAppend()
diff --git a/src/main/cpp/rollingpolicybase.cpp
b/src/main/cpp/rollingpolicybase.cpp
index 8401da21..10847682 100644
--- a/src/main/cpp/rollingpolicybase.cpp
+++ b/src/main/cpp/rollingpolicybase.cpp
@@ -47,20 +47,16 @@ RollingPolicyBase::~RollingPolicyBase()
{
}
-#if 15 < LOG4CXX_ABI_VERSION
-void RollingPolicyBase::activateOptions()
+void RollingPolicyBase::activateOptions(
LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS )
{
- // Ensure any ABI 15 overriden activateOptions is invoked
- helpers::Pool p;
- activateOptions(p);
+ m_priv->activateOptions(getFormatSpecifiers());
}
-#endif
-void RollingPolicyBase::activateOptions(LOG4CXX_NS::helpers::Pool& /* pool */)
+void RollingPolicyBase::RollingPolicyBasePrivate::activateOptions(const
pattern::PatternMap& map)
{
- if (m_priv->fileNamePatternStr.length() > 0)
+ if (this->fileNamePatternStr.length() > 0)
{
- parseFileNamePattern();
+ this->parseFileNamePattern(map);
}
else
{
@@ -104,7 +100,12 @@ LogString RollingPolicyBase::getFileNamePattern() const
*/
void RollingPolicyBase::parseFileNamePattern()
{
- m_priv->patternConverters =
PatternParser::parse(m_priv->fileNamePatternStr, getFormatSpecifiers());
+ m_priv->parseFileNamePattern(getFormatSpecifiers());
+}
+
+void RollingPolicyBase::RollingPolicyBasePrivate::parseFileNamePattern(const
pattern::PatternMap& map)
+{
+ this->patternConverters =
PatternParser::parse(this->fileNamePatternStr, map);
}
/**
diff --git a/src/main/cpp/sizebasedtriggeringpolicy.cpp
b/src/main/cpp/sizebasedtriggeringpolicy.cpp
index 64788fa7..61c7faee 100644
--- a/src/main/cpp/sizebasedtriggeringpolicy.cpp
+++ b/src/main/cpp/sizebasedtriggeringpolicy.cpp
@@ -48,7 +48,7 @@ void SizeBasedTriggeringPolicy::setMaxFileSize(size_t l)
maxFileSize = l;
}
-void SizeBasedTriggeringPolicy::activateOptions(Pool& /* p */)
+void SizeBasedTriggeringPolicy::activateOptions(
LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS )
{
}
diff --git a/src/main/cpp/smtpappender.cpp b/src/main/cpp/smtpappender.cpp
index 1165f2e0..552e51a9 100644
--- a/src/main/cpp/smtpappender.cpp
+++ b/src/main/cpp/smtpappender.cpp
@@ -586,51 +586,39 @@ bool SMTPAppender::asciiCheck(const LogString& value,
const LogString& field)
/**
Activate the specified options, such as the smtp host, the
recipient, from, etc. */
-void SMTPAppender::activateOptions(Pool& p)
+void SMTPAppender::activateOptions( LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS
)
{
- bool activate = true;
-
if (_priv->layout == 0)
{
_priv->errorHandler->error(LOG4CXX_STR("No layout set for
appender named [") + _priv->name + LOG4CXX_STR("]."));
- activate = false;
}
if (_priv->evaluator == 0)
{
_priv->errorHandler->error(LOG4CXX_STR("No
TriggeringEventEvaluator is set for appender [") +
_priv->name + LOG4CXX_STR("]."));
- activate = false;
}
if (_priv->smtpHost.empty())
{
_priv->errorHandler->error(LOG4CXX_STR("No smtpHost is set for
appender [") +
_priv->name + LOG4CXX_STR("]."));
- activate = false;
}
if (_priv->to.empty() && _priv->cc.empty() && _priv->bcc.empty())
{
_priv->errorHandler->error(LOG4CXX_STR("No recipient address is
set for appender [") +
_priv->name + LOG4CXX_STR("]."));
- activate = false;
}
- activate &= asciiCheck(_priv->to, LOG4CXX_STR("to"));
- activate &= asciiCheck(_priv->cc, LOG4CXX_STR("cc"));
- activate &= asciiCheck(_priv->bcc, LOG4CXX_STR("bcc"));
- activate &= asciiCheck(_priv->from, LOG4CXX_STR("from"));
+ asciiCheck(_priv->to, LOG4CXX_STR("to"));
+ asciiCheck(_priv->cc, LOG4CXX_STR("cc"));
+ asciiCheck(_priv->bcc, LOG4CXX_STR("bcc"));
+ asciiCheck(_priv->from, LOG4CXX_STR("from"));
#if !LOG4CXX_HAVE_LIBESMTP
_priv->errorHandler->error(LOG4CXX_STR("log4cxx built without SMTP
support."));
- activate = false;
#endif
-
- if (activate)
- {
- AppenderSkeleton::activateOptions(p);
- }
}
/**
diff --git a/src/main/cpp/socketappenderskeleton.cpp
b/src/main/cpp/socketappenderskeleton.cpp
index 613038cf..930a74f4 100644
--- a/src/main/cpp/socketappenderskeleton.cpp
+++ b/src/main/cpp/socketappenderskeleton.cpp
@@ -60,10 +60,10 @@ SocketAppenderSkeleton::~SocketAppenderSkeleton()
{
}
-void SocketAppenderSkeleton::activateOptions(Pool& p)
+void SocketAppenderSkeleton::activateOptions(
LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS )
{
- AppenderSkeleton::activateOptions(p);
- connect(p);
+ Pool my_pool;
+ connect(my_pool);
}
void SocketAppenderSkeleton::close()
diff --git a/src/main/cpp/syslogappender.cpp b/src/main/cpp/syslogappender.cpp
index 52950cc2..5a116274 100644
--- a/src/main/cpp/syslogappender.cpp
+++ b/src/main/cpp/syslogappender.cpp
@@ -367,9 +367,11 @@ void SyslogAppender::append(const spi::LoggingEventPtr&
event, Pool& p)
}
}
+#if LOG4CXX_ABI_VERSION <= 15
void SyslogAppender::activateOptions(Pool&)
{
}
+#endif
void SyslogAppender::setOption(const LogString& option, const LogString& value)
{
diff --git a/src/main/cpp/telnetappender.cpp b/src/main/cpp/telnetappender.cpp
index d196f29e..e0ddda5c 100644
--- a/src/main/cpp/telnetappender.cpp
+++ b/src/main/cpp/telnetappender.cpp
@@ -122,7 +122,7 @@ TelnetAppender::~TelnetAppender()
_priv->close();
}
-void TelnetAppender::activateOptions(Pool& /* p */)
+void TelnetAppender::activateOptions(
LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS )
{
if (_priv->serverSocket == NULL)
{
diff --git a/src/main/cpp/timebasedrollingpolicy.cpp
b/src/main/cpp/timebasedrollingpolicy.cpp
index 1abeacbe..96893227 100644
--- a/src/main/cpp/timebasedrollingpolicy.cpp
+++ b/src/main/cpp/timebasedrollingpolicy.cpp
@@ -267,16 +267,7 @@ TimeBasedRollingPolicy::TimeBasedRollingPolicy() :
TimeBasedRollingPolicy::~TimeBasedRollingPolicy(){}
-#if 15 < LOG4CXX_ABI_VERSION
-void TimeBasedRollingPolicy::activateOptions()
-{
- // Ensure any ABI 15 overriden activateOptions is invoked
- Pool p;
- activateOptions(p);
-}
-#endif
-
-void TimeBasedRollingPolicy::activateOptions(LOG4CXX_NS::helpers::Pool& pool)
+void TimeBasedRollingPolicy::activateOptions(
LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS )
{
// find out period from the filename pattern
if (getFileNamePattern().length() > 0)
@@ -297,6 +288,7 @@ void
TimeBasedRollingPolicy::activateOptions(LOG4CXX_NS::helpers::Pool& pool)
throw NullPointerException(LOG4CXX_STR("DatePatternConverter"));
}
+ Pool pool;
LogString buf;
ObjectPtr obj = std::make_shared<Date>();
formatFileName(obj, buf, pool);
diff --git a/src/main/cpp/triggeringpolicy.cpp
b/src/main/cpp/triggeringpolicy.cpp
index fb01ee79..84b54b97 100644
--- a/src/main/cpp/triggeringpolicy.cpp
+++ b/src/main/cpp/triggeringpolicy.cpp
@@ -26,16 +26,3 @@ IMPLEMENT_LOG4CXX_OBJECT(TriggeringPolicy)
TriggeringPolicy::~TriggeringPolicy()
{
}
-
-#if 15 < LOG4CXX_ABI_VERSION
-void TriggeringPolicy::activateOptions(Pool&)
-{
-}
-
-void TriggeringPolicy::activateOptions()
-{
- // Ensure any ABI 15 overriden activateOptions is invoked
- helpers::Pool p;
- activateOptions(p);
-}
-#endif
\ No newline at end of file
diff --git a/src/main/cpp/writerappender.cpp b/src/main/cpp/writerappender.cpp
index 3606c0e9..f86c1b7f 100644
--- a/src/main/cpp/writerappender.cpp
+++ b/src/main/cpp/writerappender.cpp
@@ -52,8 +52,7 @@ WriterAppender::WriterAppender(const LayoutPtr& layout)
WriterAppender::WriterAppender(const LayoutPtr& layout, const
helpers::WriterPtr& writer)
: AppenderSkeleton(std::make_unique<WriterAppenderPriv>(layout, writer))
{
- Pool p;
- activateOptions(p);
+ activateOptions();
}
#endif
@@ -69,34 +68,26 @@ WriterAppender::~WriterAppender()
_priv->close();
}
-void WriterAppender::activateOptions(Pool& p)
+void WriterAppender::activateOptions(
LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS )
{
- int errors = 0;
-
- if (_priv->layout == 0)
- {
- _priv->errorHandler->error(
- ((LogString) LOG4CXX_STR("No layout set for the
appender named ["))
- + _priv->name + LOG4CXX_STR("]."));
- errors++;
- }
+ _priv->activateOptions();
+}
- if (_priv->writer == 0)
+void WriterAppender::WriterAppenderPriv::activateOptions()
+{
+ if (this->layout == 0)
{
- _priv->errorHandler->error(
- ((LogString) LOG4CXX_STR("No writer set for the
appender named ["))
- + _priv->name + LOG4CXX_STR("]."));
- errors++;
+ this->errorHandler->error(LOG4CXX_STR("No layout set for the
appender named [")
+ + this->name + LOG4CXX_STR("]."));
}
- if (errors == 0)
+ if (this->writer == 0)
{
- AppenderSkeleton::activateOptions(p);
+ this->errorHandler->error(LOG4CXX_STR("No writer set for the
appender named [")
+ + this->name + LOG4CXX_STR("]."));
}
}
-
-
void WriterAppender::append(const spi::LoggingEventPtr& event, Pool& pool1)
{
diff --git a/src/main/cpp/xmlsocketappender.cpp
b/src/main/cpp/xmlsocketappender.cpp
index df4bd4e5..55ccb035 100644
--- a/src/main/cpp/xmlsocketappender.cpp
+++ b/src/main/cpp/xmlsocketappender.cpp
@@ -72,16 +72,14 @@ XMLSocketAppender::XMLSocketAppender(InetAddressPtr
address1, int port1)
:
SocketAppenderSkeleton(std::make_unique<XMLSocketAppenderPriv>(address1, port1,
DEFAULT_RECONNECTION_DELAY))
{
_priv->layout = std::make_shared<XMLLayout>();
- Pool p;
- activateOptions(p);
+ activateOptions();
}
XMLSocketAppender::XMLSocketAppender(const LogString& host, int port1)
: SocketAppenderSkeleton(std::make_unique<XMLSocketAppenderPriv>(host,
port1, DEFAULT_RECONNECTION_DELAY))
{
_priv->layout = std::make_shared<XMLLayout>();
- Pool p;
- activateOptions(p);
+ activateOptions();
}
XMLSocketAppender::~XMLSocketAppender()
diff --git a/src/main/include/log4cxx/appenderskeleton.h
b/src/main/include/log4cxx/appenderskeleton.h
index e7492f9d..585532c3 100644
--- a/src/main/include/log4cxx/appenderskeleton.h
+++ b/src/main/include/log4cxx/appenderskeleton.h
@@ -82,32 +82,16 @@ class LOG4CXX_EXPORT AppenderSkeleton :
[[ deprecated( "The derived appender destructor needs to
implement its cleanup" ) ]]
void finalize();
#endif
-#if LOG4CXX_ABI_VERSION <= 15
- /**
- \copybrief spi::OptionHandler::activateOptions()
- No action is performed in this implementation.
-
- @deprecated The \c pool parameter is not required and will be
removed in a future version.
- */
- void activateOptions(helpers::Pool& pool) override;
-#else
+ using spi::OptionHandler::activateOptions;
/**
\copybrief spi::OptionHandler::activateOptions()
No action is performed in this implementation.
- @deprecated This function is deprecated and will be removed in
a future version.
- */
- [[deprecated("Override activateOptions() without parameters
instead")]]
- void activateOptions(helpers::Pool& ) override;
- /**
- \copybrief spi::OptionHandler::activateOptions()
-
- No action is performed in this implementation.
+ @deprecated The \c pool parameter is not required and will be
removed in a future version.
*/
- void activateOptions() override;
-#endif
+ void activateOptions(
LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS ) override;
/**
\copybrief spi::OptionHandler::setOption()
diff --git a/src/main/include/log4cxx/consoleappender.h
b/src/main/include/log4cxx/consoleappender.h
index 328ea809..c1a98610 100644
--- a/src/main/include/log4cxx/consoleappender.h
+++ b/src/main/include/log4cxx/consoleappender.h
@@ -82,12 +82,13 @@ class LOG4CXX_EXPORT ConsoleAppender : public WriterAppender
*/
LogString getTarget() const;
+ using WriterAppender::activateOptions;
/**
\copybrief WriterAppender::activateOptions()
No action is performed in this implementation.
*/
- void activateOptions(helpers::Pool& p) override;
+ void activateOptions(
LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS ) override;
/**
\copybrief WriterAppender::setOption()
diff --git a/src/main/include/log4cxx/db/dbappender.h
b/src/main/include/log4cxx/db/dbappender.h
index d7d494d6..163da909 100644
--- a/src/main/include/log4cxx/db/dbappender.h
+++ b/src/main/include/log4cxx/db/dbappender.h
@@ -141,7 +141,7 @@ class LOG4CXX_EXPORT DBAppender : public AppenderSkeleton
/**
Activate the specified options.
*/
- void activateOptions(helpers::Pool& p) override;
+ void activateOptions(
LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS ) override;
/**
* Adds the event to the buffer. When full the buffer is
flushed.
diff --git a/src/main/include/log4cxx/db/odbcappender.h
b/src/main/include/log4cxx/db/odbcappender.h
index 1cddc8d1..5d4de206 100644
--- a/src/main/include/log4cxx/db/odbcappender.h
+++ b/src/main/include/log4cxx/db/odbcappender.h
@@ -179,7 +179,7 @@ class LOG4CXX_EXPORT ODBCAppender : public AppenderSkeleton
/**
Activate the specified options.
*/
- void activateOptions(helpers::Pool& p) override;
+ void activateOptions(
LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS ) override;
/**
* Adds the event to the buffer. When full the buffer is
flushed.
diff --git a/src/main/include/log4cxx/fileappender.h
b/src/main/include/log4cxx/fileappender.h
index 48d01c6c..1649c0da 100644
--- a/src/main/include/log4cxx/fileappender.h
+++ b/src/main/include/log4cxx/fileappender.h
@@ -114,8 +114,9 @@ class LOG4CXX_EXPORT FileAppender : public WriterAppender
/** Returns the value of the <b>File</b> option. */
LogString getFile() const;
+ using WriterAppender::activateOptions;
/**
- \copybrief AppenderSkeleton::activateOptions()
+ \copybrief WriterAppender::activateOptions()
Sets and <i>opens</i> the file where the log output will
go. The specified file must be writable.
@@ -123,7 +124,7 @@ class LOG4CXX_EXPORT FileAppender : public WriterAppender
If there was already an opened file, then the previous file
is closed first.
*/
- void activateOptions(helpers::Pool& p) override;
+ void activateOptions(
LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS ) override;
/**
\copybrief AppenderSkeleton::setOption()
@@ -218,7 +219,7 @@ class LOG4CXX_EXPORT FileAppender : public WriterAppender
static LogString stripDuplicateBackslashes(const LogString&
name);
protected:
- void activateOptionsInternal(helpers::Pool& p);
+ void activateOptionsInternal();
/**
Sets and <i>opens</i> the file where the log output will
@@ -238,14 +239,18 @@ class LOG4CXX_EXPORT FileAppender : public WriterAppender
truncate fileName.
@param bufferedIO Do we do bufferedIO?
@param bufferSize How big should the IO buffer be?
- @param p memory pool for operation.
*/
void setFileInternal(const LogString& file, bool append,
- bool bufferedIO, size_t bufferSize,
- helpers::Pool& p);
+ bool bufferedIO, size_t bufferSize);
void setFileInternal(const LogString& file);
+#if LOG4CXX_ABI_VERSION <= 15
+ void activateOptionsInternal(helpers::Pool& p);
+ void setFileInternal(const LogString& file, bool append,
+ bool bufferedIO, size_t bufferSize,
+ helpers::Pool& p);
+#endif
private:
FileAppender(const FileAppender&);
FileAppender& operator=(const FileAppender&);
diff --git a/src/main/include/log4cxx/filter/expressionfilter.h
b/src/main/include/log4cxx/filter/expressionfilter.h
index 73548eae..591c09db 100644
--- a/src/main/include/log4cxx/filter/expressionfilter.h
+++ b/src/main/include/log4cxx/filter/expressionfilter.h
@@ -94,7 +94,7 @@ class LOG4CXX_EXPORT ExpressionFilter: public
LOG4CXX_NS::spi::Filter
ExpressionFilter();
- void activateOptions(helpers::Pool& p) override;
+ void activateOptions(
LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS ) override;
void setExpression(const LogString& expression);
diff --git a/src/main/include/log4cxx/fmtlayout.h
b/src/main/include/log4cxx/fmtlayout.h
index fdcd386d..920a1521 100644
--- a/src/main/include/log4cxx/fmtlayout.h
+++ b/src/main/include/log4cxx/fmtlayout.h
@@ -255,12 +255,13 @@ class LOG4CXX_EXPORT FMTLayout : public Layout
return true;
}
+ using Layout::activateOptions;
/**
\copybrief spi::OptionHandler::activateOptions()
- No action is performed in this implementation.
+ Calculates the length of the formtted output.
*/
- void activateOptions(helpers::Pool& /* p */) override;
+ void activateOptions(
LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS ) override;
/**
\copybrief spi::OptionHandler::setOption()
diff --git a/src/main/include/log4cxx/helpers/onlyonceerrorhandler.h
b/src/main/include/log4cxx/helpers/onlyonceerrorhandler.h
index 21111668..7725f21e 100644
--- a/src/main/include/log4cxx/helpers/onlyonceerrorhandler.h
+++ b/src/main/include/log4cxx/helpers/onlyonceerrorhandler.h
@@ -64,13 +64,14 @@ class LOG4CXX_EXPORT OnlyOnceErrorHandler :
void setLogger(const LoggerPtr& logger) override;
+#if LOG4CXX_ABI_VERSION <= 15
/**
\copybrief spi::OptionHandler::activateOptions()
No action is performed in this implementation.
*/
void activateOptions(helpers::Pool& p) override;
-
+#endif
/**
\copybrief spi::OptionHandler::setOption()
diff --git a/src/main/include/log4cxx/htmllayout.h
b/src/main/include/log4cxx/htmllayout.h
index 0f72225f..45b8a0e5 100644
--- a/src/main/include/log4cxx/htmllayout.h
+++ b/src/main/include/log4cxx/htmllayout.h
@@ -78,13 +78,14 @@ class LOG4CXX_EXPORT HTMLLayout : public Layout
*/
LogString getContentType() const override;
+#if LOG4CXX_ABI_VERSION <= 15
/**
\copybrief spi::OptionHandler::activateOptions()
No action is performed in this implementation.
*/
- void activateOptions(helpers::Pool& /* p */) override {}
-
+ void activateOptions(
LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS ) override {}
+#endif
/**
\copybrief spi::OptionHandler::setOption()
diff --git a/src/main/include/log4cxx/jsonlayout.h
b/src/main/include/log4cxx/jsonlayout.h
index 31e47c14..7d561f77 100644
--- a/src/main/include/log4cxx/jsonlayout.h
+++ b/src/main/include/log4cxx/jsonlayout.h
@@ -100,12 +100,13 @@ class LOG4CXX_EXPORT JSONLayout : public Layout
*/
LogString getContentType() const override;
+ using Layout::activateOptions;
/**
\copybrief spi::OptionHandler::activateOptions()
- No action is performed in this implementation.
+ Calculates the length of the formtted output.
*/
- void activateOptions(helpers::Pool& /* p */) override;
+ void activateOptions(
LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS ) override;
/**
\copybrief spi::OptionHandler::setOption()
diff --git a/src/main/include/log4cxx/layout.h
b/src/main/include/log4cxx/layout.h
index 33cc2ca0..1ede02c4 100644
--- a/src/main/include/log4cxx/layout.h
+++ b/src/main/include/log4cxx/layout.h
@@ -77,23 +77,14 @@ class LOG4CXX_EXPORT Layout :
virtual bool ignoresThrowable() const = 0;
#if 15 < LOG4CXX_ABI_VERSION
+ using spi::OptionHandler::activateOptions;
/**
\copybrief spi::OptionHandler::activateOptions()
No action is performed in this implementation.
*/
- void activateOptions() override;
-
- /**
- \copybrief spi::OptionHandler::activateOptions()
-
- No action is performed in this implementation.
- @deprecated This function is deprecated and will be removed in
a future version.
- */
- [[deprecated("Override activateOptions() without parameters
instead")]]
- void activateOptions(helpers::Pool& ) override;
+ void activateOptions(
LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS ) override;
#endif
-
protected:
/**
* The expected length of a formatted event excluding the
message text
diff --git a/src/main/include/log4cxx/net/smtpappender.h
b/src/main/include/log4cxx/net/smtpappender.h
index e9059ee1..f108bec9 100644
--- a/src/main/include/log4cxx/net/smtpappender.h
+++ b/src/main/include/log4cxx/net/smtpappender.h
@@ -141,7 +141,7 @@ class LOG4CXX_EXPORT SMTPAppender : public AppenderSkeleton
<li>a non-ascii character is detected where not permitted</li>
</ul>.
*/
- void activateOptions(helpers::Pool& p) override;
+ void activateOptions(
LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS ) override;
/**
Perform SMTPAppender specific appending actions, mainly adding
diff --git a/src/main/include/log4cxx/net/socketappenderskeleton.h
b/src/main/include/log4cxx/net/socketappenderskeleton.h
index 5608d24b..afb0c530 100644
--- a/src/main/include/log4cxx/net/socketappenderskeleton.h
+++ b/src/main/include/log4cxx/net/socketappenderskeleton.h
@@ -51,12 +51,13 @@ class LOG4CXX_EXPORT SocketAppenderSkeleton : public
AppenderSkeleton
*/
SocketAppenderSkeleton(const LogString& host, int port, int
reconnectionDelay);
+ using spi::OptionHandler::activateOptions;
/**
\copybrief AppenderSkeleton::activateOptions()
Connects to the specified <b>RemoteHost</b> and <b>Port</b>.
*/
- void activateOptions(helpers::Pool& p) override;
+ void activateOptions(
LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS ) override;
void close() override;
diff --git a/src/main/include/log4cxx/net/syslogappender.h
b/src/main/include/log4cxx/net/syslogappender.h
index e4c2e808..9b4072c2 100644
--- a/src/main/include/log4cxx/net/syslogappender.h
+++ b/src/main/include/log4cxx/net/syslogappender.h
@@ -75,13 +75,14 @@ class LOG4CXX_EXPORT SyslogAppender : public
AppenderSkeleton
void append(const spi::LoggingEventPtr& event, helpers::Pool&
p) override;
+#if LOG4CXX_ABI_VERSION <= 15
/**
\copybrief AppenderSkeleton::activateOptions()
No action is performed in this implementation.
*/
void activateOptions(helpers::Pool& p) override;
-
+#endif
/**
\copybrief AppenderSkeleton::setOption()
diff --git a/src/main/include/log4cxx/net/telnetappender.h
b/src/main/include/log4cxx/net/telnetappender.h
index 3f6427e1..e52bb6c9 100644
--- a/src/main/include/log4cxx/net/telnetappender.h
+++ b/src/main/include/log4cxx/net/telnetappender.h
@@ -84,12 +84,13 @@ class LOG4CXX_EXPORT TelnetAppender : public
AppenderSkeleton
void setEncoding(const LogString& value);
+ using AppenderSkeleton::activateOptions;
/**
\copybrief AppenderSkeleton::activateOptions()
Create the socket handler and wait for connections.
*/
- void activateOptions(helpers::Pool& p) override;
+ void activateOptions(
LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS ) override;
/**
diff --git a/src/main/include/log4cxx/net/xmlsocketappender.h
b/src/main/include/log4cxx/net/xmlsocketappender.h
index 0c9d8379..5985611c 100644
--- a/src/main/include/log4cxx/net/xmlsocketappender.h
+++ b/src/main/include/log4cxx/net/xmlsocketappender.h
@@ -133,6 +133,7 @@ class LOG4CXX_EXPORT XMLSocketAppender : public
SocketAppenderSkeleton
*/
XMLSocketAppender(const LogString& host, int port);
+ using SocketAppenderSkeleton::activateOptions;
protected:
void setSocket(LOG4CXX_NS::helpers::SocketPtr& socket,
helpers::Pool& p) override;
diff --git a/src/main/include/log4cxx/nt/nteventlogappender.h
b/src/main/include/log4cxx/nt/nteventlogappender.h
index dc998708..3f755fa4 100644
--- a/src/main/include/log4cxx/nt/nteventlogappender.h
+++ b/src/main/include/log4cxx/nt/nteventlogappender.h
@@ -42,12 +42,13 @@ class LOG4CXX_EXPORT NTEventLogAppender : public
AppenderSkeleton
virtual ~NTEventLogAppender();
+ using spi::OptionHandler::activateOptions;
/**
\copybrief AppenderSkeleton::activateOptions()
Calls <a
href="https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-registereventsourcew">RegisterEventSource</a>.
*/
- void activateOptions(helpers::Pool& p) override;
+ void activateOptions(
LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS ) override;
void close() override;
/**
diff --git a/src/main/include/log4cxx/patternlayout.h
b/src/main/include/log4cxx/patternlayout.h
index e11917bf..98820118 100644
--- a/src/main/include/log4cxx/patternlayout.h
+++ b/src/main/include/log4cxx/patternlayout.h
@@ -479,12 +479,13 @@ class LOG4CXX_EXPORT PatternLayout : public Layout
*/
LogString getConversionPattern() const;
+ using Layout::activateOptions;
/**
\copybrief spi::OptionHandler::activateOptions()
Calls createPatternParser
*/
- void activateOptions(helpers::Pool& p) override;
+ void activateOptions(
LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS ) override;
/**
\copybrief spi::OptionHandler::setOption()
diff --git a/src/main/include/log4cxx/private/rollingfileappender_priv.h
b/src/main/include/log4cxx/private/rollingfileappender_priv.h
index c857594a..f2c6e9a8 100644
--- a/src/main/include/log4cxx/private/rollingfileappender_priv.h
+++ b/src/main/include/log4cxx/private/rollingfileappender_priv.h
@@ -51,6 +51,8 @@ struct RollingFileAppender::RollingFileAppenderPriv : public
FileAppenderPriv
* save the loggingevent
*/
spi::LoggingEventPtr _event;
+
+ bool activateOptions();
};
} // namespace rolling
diff --git a/src/main/include/log4cxx/private/rollingpolicybase_priv.h
b/src/main/include/log4cxx/private/rollingpolicybase_priv.h
index 467fa448..0b2fe632 100644
--- a/src/main/include/log4cxx/private/rollingpolicybase_priv.h
+++ b/src/main/include/log4cxx/private/rollingpolicybase_priv.h
@@ -41,6 +41,10 @@ struct RollingPolicyBase::RollingPolicyBasePrivate {
LogString fileNamePatternStr;
bool createIntermediateDirectories = true;
+
+ void activateOptions(const pattern::PatternMap& map);
+
+ void parseFileNamePattern(const pattern::PatternMap& map);
};
}
diff --git a/src/main/include/log4cxx/private/writerappender_priv.h
b/src/main/include/log4cxx/private/writerappender_priv.h
index 348f2124..7ba57d29 100644
--- a/src/main/include/log4cxx/private/writerappender_priv.h
+++ b/src/main/include/log4cxx/private/writerappender_priv.h
@@ -105,6 +105,8 @@ struct WriterAppender::WriterAppenderPriv : public
AppenderSkeleton::AppenderSke
std::lock_guard<std::recursive_mutex> lock(this->mutex);
this->writer = newWriter;
}
+
+ void activateOptions();
};
}
diff --git a/src/main/include/log4cxx/rolling/filterbasedtriggeringpolicy.h
b/src/main/include/log4cxx/rolling/filterbasedtriggeringpolicy.h
index 8ff908ee..e60bcd6f 100644
--- a/src/main/include/log4cxx/rolling/filterbasedtriggeringpolicy.h
+++ b/src/main/include/log4cxx/rolling/filterbasedtriggeringpolicy.h
@@ -100,12 +100,13 @@ class LOG4CXX_EXPORT FilterBasedTriggeringPolicy : public
TriggeringPolicy
*/
spi::FilterPtr& getFilter();
+ using TriggeringPolicy::activateOptions;
/**
- \copybrief spi::OptionHandler::activateOptions()
+ \copybrief TriggeringPolicy::activateOptions()
Activates all attached filters.
*/
- void activateOptions(helpers::Pool&) override;
+ void activateOptions(
LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS ) override;
/**
\copybrief spi::OptionHandler::setOption()
diff --git a/src/main/include/log4cxx/rolling/fixedwindowrollingpolicy.h
b/src/main/include/log4cxx/rolling/fixedwindowrollingpolicy.h
index 13e54da4..b0beca77 100644
--- a/src/main/include/log4cxx/rolling/fixedwindowrollingpolicy.h
+++ b/src/main/include/log4cxx/rolling/fixedwindowrollingpolicy.h
@@ -90,6 +90,7 @@ class LOG4CXX_EXPORT FixedWindowRollingPolicy : public
RollingPolicyBase
FixedWindowRollingPolicy();
~FixedWindowRollingPolicy();
+ using RollingPolicyBase::activateOptions;
/**
\copybrief RollingPolicyBase::activateOptions()
@@ -97,7 +98,7 @@ class LOG4CXX_EXPORT FixedWindowRollingPolicy : public
RollingPolicyBase
\sa RollingPolicyBase::activateOptions()
*/
- void activateOptions(helpers::Pool& p) override;
+ void activateOptions(
LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS ) override;
/**
\copybrief RollingPolicyBase::setOption()
diff --git a/src/main/include/log4cxx/rolling/manualtriggeringpolicy.h
b/src/main/include/log4cxx/rolling/manualtriggeringpolicy.h
index abdffdf0..e7fe90fc 100644
--- a/src/main/include/log4cxx/rolling/manualtriggeringpolicy.h
+++ b/src/main/include/log4cxx/rolling/manualtriggeringpolicy.h
@@ -67,12 +67,13 @@ class LOG4CXX_EXPORT ManualTriggeringPolicy : public
TriggeringPolicy
const LogString& filename,
size_t fileLength) override;
+ using TriggeringPolicy::activateOptions;
/**
- \copybrief spi::OptionHandler::activateOptions()
+ \copybrief TriggeringPolicy::activateOptions()
No action is performed in this implementation.
*/
- void activateOptions(helpers::Pool&) override;
+ void activateOptions(
LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS ) override;
/**
\copybrief spi::OptionHandler::setOption()
diff --git a/src/main/include/log4cxx/rolling/multiprocessrollingfileappender.h
b/src/main/include/log4cxx/rolling/multiprocessrollingfileappender.h
index c1b38a84..7ce9d8c5 100644
--- a/src/main/include/log4cxx/rolling/multiprocessrollingfileappender.h
+++ b/src/main/include/log4cxx/rolling/multiprocessrollingfileappender.h
@@ -56,7 +56,7 @@ class LOG4CXX_EXPORT MultiprocessRollingFileAppender : public
RollingFileAppende
\sa FileAppender::activateOptions()
*/
- void activateOptions(helpers::Pool& pool ) override;
+ void activateOptions(
LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS ) override;
/**
Implements the usual roll over behaviour.
diff --git a/src/main/include/log4cxx/rolling/rollingfileappender.h
b/src/main/include/log4cxx/rolling/rollingfileappender.h
index e34916a3..a6353dd1 100644
--- a/src/main/include/log4cxx/rolling/rollingfileappender.h
+++ b/src/main/include/log4cxx/rolling/rollingfileappender.h
@@ -147,12 +147,13 @@ class LOG4CXX_EXPORT RollingFileAppender : public
FileAppender
*/
void setOption( const LogString& option, const LogString& value
) override;
+ using spi::OptionHandler::activateOptions;
/**
\copybrief FileAppender::activateOptions()
\sa FileAppender::activateOptions()
*/
- void activateOptions(helpers::Pool& pool ) override;
+ void activateOptions(
LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS ) override;
/**
Implements the configured roll over behaviour.
diff --git a/src/main/include/log4cxx/rolling/rollingpolicybase.h
b/src/main/include/log4cxx/rolling/rollingpolicybase.h
index f228c59f..d81ae3c6 100644
--- a/src/main/include/log4cxx/rolling/rollingpolicybase.h
+++ b/src/main/include/log4cxx/rolling/rollingpolicybase.h
@@ -56,23 +56,13 @@ class LOG4CXX_EXPORT RollingPolicyBase :
RollingPolicyBase();
virtual ~RollingPolicyBase();
- /**
- \copybrief RollingPolicy::activateOptions()
-
- Logs a warning if FileNamePattern is not set.
-
- \sa RollingPolicy::activateOptions()
- */
-
-#if 15 < LOG4CXX_ABI_VERSION
+ using spi::OptionHandler::activateOptions;
/**
\copybrief spi::OptionHandler::activateOptions()
- No action is performed in this implementation.
+ Converts the file name pattern to a collection of formaters.
*/
- void activateOptions() override;
-#endif
- void activateOptions(helpers::Pool& p) override;
+ void activateOptions(
LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS ) override;
/**
A map from a name to the object implementing the (date or
index) formatting.
diff --git a/src/main/include/log4cxx/rolling/sizebasedtriggeringpolicy.h
b/src/main/include/log4cxx/rolling/sizebasedtriggeringpolicy.h
index f26effc5..11f50597 100644
--- a/src/main/include/log4cxx/rolling/sizebasedtriggeringpolicy.h
+++ b/src/main/include/log4cxx/rolling/sizebasedtriggeringpolicy.h
@@ -74,12 +74,13 @@ class LOG4CXX_EXPORT SizeBasedTriggeringPolicy : public
TriggeringPolicy
void setMaxFileSize(size_t l);
+ using TriggeringPolicy::activateOptions;
/**
- \copybrief spi::OptionHandler::activateOptions()
+ \copybrief TriggeringPolicy::activateOptions()
No action is performed in this implementation.
*/
- void activateOptions(helpers::Pool&) override;
+ void activateOptions(
LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS ) override;
/**
\copybrief spi::OptionHandler::setOption()
@@ -89,9 +90,9 @@ class LOG4CXX_EXPORT SizeBasedTriggeringPolicy : public
TriggeringPolicy
MaxFileSize | (\ref fileSize "1") | 10 MB |
\anchor fileSize (1) An integer in the range 0 - 2^63.
- You can specify the value with the suffixes "KB", "MB" or "GB"
so that the integer is
- interpreted being expressed respectively in kilobytes,
megabytes
- or gigabytes. For example, the value "10KB" will be
interpreted as 10240.
+ You can specify the value with the suffixes "KB", "MB", "GB"
or "TB" so that the integer is
+ interpreted being expressed respectively in kilobytes,
megabytes, gigabytes
+ or terabytes. For example, the value "10KB" will be
interpreted as 10240.
*/
void setOption(const LogString& option, const LogString& value)
override;
};
diff --git a/src/main/include/log4cxx/rolling/timebasedrollingpolicy.h
b/src/main/include/log4cxx/rolling/timebasedrollingpolicy.h
index 2f9ae007..9a5578a1 100755
--- a/src/main/include/log4cxx/rolling/timebasedrollingpolicy.h
+++ b/src/main/include/log4cxx/rolling/timebasedrollingpolicy.h
@@ -154,6 +154,7 @@ class LOG4CXX_EXPORT TimeBasedRollingPolicy : public
virtual RollingPolicyBase,
TimeBasedRollingPolicy();
virtual ~TimeBasedRollingPolicy();
+ using RollingPolicyBase::activateOptions;
/**
\copybrief RollingPolicyBase::activateOptions()
@@ -161,10 +162,7 @@ class LOG4CXX_EXPORT TimeBasedRollingPolicy : public
virtual RollingPolicyBase,
\sa RollingPolicyBase::activateOptions()
*/
-#if 15 < LOG4CXX_ABI_VERSION
- void activateOptions() override;
-#endif
- void activateOptions(helpers::Pool& ) override;
+ void activateOptions(
LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS) override;
void setMultiprocess(bool multiprocess);
diff --git a/src/main/include/log4cxx/rolling/triggeringpolicy.h
b/src/main/include/log4cxx/rolling/triggeringpolicy.h
index 4721d6af..ac6b2dba 100644
--- a/src/main/include/log4cxx/rolling/triggeringpolicy.h
+++ b/src/main/include/log4cxx/rolling/triggeringpolicy.h
@@ -70,15 +70,6 @@ class LOG4CXX_EXPORT TriggeringPolicy :
const LogString& filename,
size_t fileLength) = 0;
-#if 15 < LOG4CXX_ABI_VERSION
- /**
- \copybrief spi::OptionHandler::activateOptions()
-
- No action is performed in this implementation.
- */
- void activateOptions(helpers::Pool& ) override;
- void activateOptions() override;
-#endif
};
LOG4CXX_PTR_DEF(TriggeringPolicy);
diff --git a/src/main/include/log4cxx/simplelayout.h
b/src/main/include/log4cxx/simplelayout.h
index 20d90902..f0fb2716 100644
--- a/src/main/include/log4cxx/simplelayout.h
+++ b/src/main/include/log4cxx/simplelayout.h
@@ -63,12 +63,14 @@ class LOG4CXX_EXPORT SimpleLayout : public Layout
return true;
}
+#if LOG4CXX_ABI_VERSION <= 15
/**
\copybrief spi::OptionHandler::activateOptions()
No action is performed in this implementation.
*/
- void activateOptions(helpers::Pool& /* p */) override {}
+ void activateOptions(
LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS ) override {}
+#endif
/**
\copybrief spi::OptionHandler::setOption()
diff --git a/src/main/include/log4cxx/spi/appenderattachable.h
b/src/main/include/log4cxx/spi/appenderattachable.h
index 2498dc96..a716faba 100644
--- a/src/main/include/log4cxx/spi/appenderattachable.h
+++ b/src/main/include/log4cxx/spi/appenderattachable.h
@@ -93,10 +93,4 @@ LOG4CXX_PTR_DEF(AppenderAttachable);
}
}
-#if 15 < LOG4CXX_ABI_VERSION
-#define LOG4CXX_16_VIRTUAL_SPECIFIER override
-#else
-#define LOG4CXX_16_VIRTUAL_SPECIFIER
-#endif
-
#endif //_LOG4CXX_SPI_APPENDER_ATTACHABLE_H_
diff --git a/src/main/include/log4cxx/spi/errorhandler.h
b/src/main/include/log4cxx/spi/errorhandler.h
index ef0af515..a48a6d03 100644
--- a/src/main/include/log4cxx/spi/errorhandler.h
+++ b/src/main/include/log4cxx/spi/errorhandler.h
@@ -129,14 +129,15 @@ class LOG4CXX_EXPORT ErrorHandler : public virtual
OptionHandler
*/
virtual bool errorReported() const = 0;
+ using OptionHandler::activateOptions;
/**
\copybrief spi::OptionHandler::activateOptions()
No action is performed in this implementation.
*/
- void activateOptions(helpers::Pool& ) override;
- void activateOptions() override;
+ void activateOptions(
LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS ) override;
#endif
+
};
LOG4CXX_PTR_DEF(ErrorHandler);
diff --git a/src/main/include/log4cxx/spi/filter.h
b/src/main/include/log4cxx/spi/filter.h
index 769f0f9c..7049b268 100644
--- a/src/main/include/log4cxx/spi/filter.h
+++ b/src/main/include/log4cxx/spi/filter.h
@@ -102,33 +102,13 @@ class LOG4CXX_EXPORT Filter : public virtual OptionHandler
};
-#if LOG4CXX_ABI_VERSION <= 15
+ using OptionHandler::activateOptions;
/**
\copybrief spi::OptionHandler::activateOptions()
No action is performed in this implementation.
-
- @deprecated The \c pool parameter is not required and will be
removed in a future version.
- */
- void activateOptions(helpers::Pool& /* pool */) override;
-#else
- /**
- \copybrief spi::OptionHandler::activateOptions()
-
- No action is performed in this implementation.
- */
- void activateOptions() override;
-
- /**
- \copybrief spi::OptionHandler::activateOptions()
-
- No action is performed in this implementation.
-
- @deprecated This function is deprecated and will be removed in
a future version.
*/
- [[deprecated("Override activateOptions() without parameters
instead")]]
- void activateOptions(helpers::Pool& ) override;
-#endif
+ void activateOptions(
LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS ) override;
/**
\copybrief spi::OptionHandler::setOption()
diff --git a/src/main/include/log4cxx/spi/optionhandler.h
b/src/main/include/log4cxx/spi/optionhandler.h
index 1065677d..3841452f 100644
--- a/src/main/include/log4cxx/spi/optionhandler.h
+++ b/src/main/include/log4cxx/spi/optionhandler.h
@@ -43,25 +43,31 @@ class LOG4CXX_EXPORT OptionHandler : public virtual
helpers::Object
<p>This allows to defer activiation of the options until all
options have been set. This is required for components which
have
- related options that remain ambigous until all are set.
+ related options that remain ambiguous until all are set.
<p>For example, the FileAppender has
the <code>File</code> and <b>Append</b> options both of
- which are ambigous until the other is also set.
+ which are ambiguous until the other is also set.
*/
#if LOG4CXX_ABI_VERSION <= 15
+#define LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS helpers::Pool& p
+#define LOG4CXX_ACTIVATE_OPTIONS_PARAMETER p
void activateOptions();
/**
- @deprecated The \c pool parameter is not required and will be
removed in a future version.
+ @deprecated The \c pool parameter is not used and will be
removed in a future version.
+ Implement this method for now, but plan to migrate to
activateOptions() without parameters.
*/
- virtual void activateOptions(helpers::Pool& p) = 0;
+ virtual void activateOptions(helpers::Pool&) = 0;
#else
+#define LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS
+#define LOG4CXX_ACTIVATE_OPTIONS_PARAMETER
virtual void activateOptions() = 0;
/**
@deprecated This function is deprecated and will be removed in
a future version.
+ Call activateOptions() without parameters instead.
*/
- [[deprecated("Override activateOptions() without parameters
instead")]]
- virtual void activateOptions(helpers::Pool& );
+ [[deprecated("Use activateOptions() without parameters
instead")]]
+ void activateOptions(helpers::Pool&);
#endif
/**
@@ -80,4 +86,10 @@ class LOG4CXX_EXPORT OptionHandler : public virtual
helpers::Object
} // namespace log4cxx
+#if 15 < LOG4CXX_ABI_VERSION
+#define LOG4CXX_16_VIRTUAL_SPECIFIER override
+#else
+#define LOG4CXX_16_VIRTUAL_SPECIFIER
+#endif
+
#endif //_LOG4CXX_SPI_OPTION_HANDLER_H
diff --git a/src/main/include/log4cxx/varia/fallbackerrorhandler.h
b/src/main/include/log4cxx/varia/fallbackerrorhandler.h
index c3dfce6a..a4599b83 100644
--- a/src/main/include/log4cxx/varia/fallbackerrorhandler.h
+++ b/src/main/include/log4cxx/varia/fallbackerrorhandler.h
@@ -69,18 +69,19 @@ class LOG4CXX_EXPORT FallbackErrorHandler :
*/
void setLogger(const LoggerPtr& logger) override;
+#if LOG4CXX_ABI_VERSION <= 15
/**
\copybrief spi::OptionHandler::activateOptions()
No action is performed in this implementation.
*/
- void activateOptions(helpers::Pool& p) override;
+ void activateOptions(
LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS ) override;
+#endif
+
/**
\copybrief spi::OptionHandler::setOption()
*/
void setOption(const LogString& option, const LogString& value)
override;
-
-
/**
Prints the message and the stack trace of the exception on
<code>System.err</code>.
diff --git a/src/main/include/log4cxx/writerappender.h
b/src/main/include/log4cxx/writerappender.h
index 85f46b38..3e38f83a 100644
--- a/src/main/include/log4cxx/writerappender.h
+++ b/src/main/include/log4cxx/writerappender.h
@@ -54,11 +54,12 @@ class LOG4CXX_EXPORT WriterAppender : public
AppenderSkeleton
public:
~WriterAppender();
+ using AppenderSkeleton::activateOptions;
/**
Derived appenders should override this method if option
structure
requires it.
*/
- void activateOptions(helpers::Pool& pool) override;
+ void activateOptions(
LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS ) override;
/**
If the <b>ImmediateFlush</b> option is set to
diff --git a/src/main/include/log4cxx/xml/xmllayout.h
b/src/main/include/log4cxx/xml/xmllayout.h
index 40484941..f0ec5b09 100644
--- a/src/main/include/log4cxx/xml/xmllayout.h
+++ b/src/main/include/log4cxx/xml/xmllayout.h
@@ -97,13 +97,15 @@ class LOG4CXX_EXPORT XMLLayout : public Layout
*/
bool getProperties();
+#if LOG4CXX_ABI_VERSION <= 15
+ using Layout::activateOptions;
/**
\copybrief spi::OptionHandler::activateOptions()
No action is performed in this implementation.
*/
- void activateOptions(helpers::Pool& /* p */) override { }
-
+ void activateOptions(
LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS ) override { }
+#endif
/**
\copybrief spi::OptionHandler::setOption()
diff --git a/src/site/doxy/Doxyfile.in b/src/site/doxy/Doxyfile.in
index 009395ac..56c21fcc 100644
--- a/src/site/doxy/Doxyfile.in
+++ b/src/site/doxy/Doxyfile.in
@@ -2350,8 +2350,10 @@ PREDEFINED = LOG4CXX_NS=log4cxx \
LOG4CXX_UNICHAR_API \
LOG4CXX_CFSTRING_API \
LOG4CXX_ABI_VERSION=@log4cxx_ABI_VER@ \
+
LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS=helpers::Pool& p \
+ LOG4CXX_ACTIVATE_OPTIONS_PARAMETER=p \
LOG4CXX_HAS_DOMCONFIGURATOR=1 \
-
LOG4CXX_ASYNC_BUFFER_SUPPORTS_FMT=1
+ LOG4CXX_ASYNC_BUFFER_SUPPORTS_FMT=1
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The
diff --git a/src/test/cpp/CMakeLists.txt b/src/test/cpp/CMakeLists.txt
index ee114340..5e18a1d4 100644
--- a/src/test/cpp/CMakeLists.txt
+++ b/src/test/cpp/CMakeLists.txt
@@ -64,6 +64,7 @@ set(ALL_LOG4CXX_TESTS
mdctestcase
minimumtestcase
ndctestcase
+ optionhandlertest
patternlayouttest
propertyconfiguratortest
rollingfileappendertestcase
diff --git a/src/test/cpp/asyncappendertestcase.cpp
b/src/test/cpp/asyncappendertestcase.cpp
index 847601ba..4fce26e8 100644
--- a/src/test/cpp/asyncappendertestcase.cpp
+++ b/src/test/cpp/asyncappendertestcase.cpp
@@ -401,8 +401,7 @@ class AsyncAppenderTestCase : public
AppenderSkeletonTestCase
asyncAppender =
std::make_shared<AsyncAppender>();
asyncAppender->setName(LOG4CXX_STR("async-testBadAppender"));
asyncAppender->addAppender(std::make_shared<NullPointerAppender>());
- Pool p;
- asyncAppender->activateOptions(p);
+ asyncAppender->activateOptions();
r->getRootLogger()->addAppender(asyncAppender);
r->setConfigured(true);
});
@@ -441,8 +440,7 @@ class AsyncAppenderTestCase : public
AppenderSkeletonTestCase
async->setName(LOG4CXX_STR("async-testBufferOverflowBehavior"));
async->setBufferSize(5);
async->setBlocking(false);
- Pool p;
- async->activateOptions(p);
+ async->activateOptions();
r->getRootLogger()->addAppender(async);
r->setConfigured(true);
});
@@ -526,8 +524,7 @@ class AsyncAppenderTestCase : public
AppenderSkeletonTestCase
async = std::make_shared<AsyncAppender>();
async->setName(LOG4CXX_STR("withLoggingAppender"));
async->setBufferSize(5);
- Pool p;
- async->activateOptions(p);
+ async->activateOptions();
r->getRootLogger()->addAppender(async);
r->setConfigured(true);
});
diff --git a/src/test/cpp/benchmark/benchmark.cpp
b/src/test/cpp/benchmark/benchmark.cpp
index 3e0f7baf..40658774 100644
--- a/src/test/cpp/benchmark/benchmark.cpp
+++ b/src/test/cpp/benchmark/benchmark.cpp
@@ -49,10 +49,6 @@ public:
m_priv->layout->format(buf, event, p);
}
- void activateOptions(helpers::Pool& /* pool */) override
- {
- }
-
void setOption(const LogString& option, const LogString& value) override
{
}
diff --git a/src/test/cpp/consoleappendertestcase.cpp
b/src/test/cpp/consoleappendertestcase.cpp
index 51383861..39513e50 100644
--- a/src/test/cpp/consoleappendertestcase.cpp
+++ b/src/test/cpp/consoleappendertestcase.cpp
@@ -46,9 +46,8 @@ class ConsoleAppenderTestCase : public WriterAppenderTestCase
void testNoLayout()
{
- Pool p;
ConsoleAppenderPtr appender(new ConsoleAppender());
- appender->activateOptions(p);
+ appender->activateOptions();
LoggerPtr logger(Logger::getRootLogger());
logger->addAppender(appender);
LOG4CXX_INFO(logger, "No layout specified for
ConsoleAppender");
diff --git a/src/test/cpp/encodingtest.cpp b/src/test/cpp/encodingtest.cpp
index 7e190b19..2cde6828 100644
--- a/src/test/cpp/encodingtest.cpp
+++ b/src/test/cpp/encodingtest.cpp
@@ -170,16 +170,15 @@ private:
{
FileAppenderPtr appender(new FileAppender());
PatternLayoutPtr layout(new PatternLayout());
- Pool p;
layout->setConversionPattern(LOG4CXX_STR("%p - %m\n"));
- layout->activateOptions(p);
+ layout->activateOptions();
appender->setAppend(false);
appender->setEncoding(encoding);
appender->setFile(filename);
appender->setLayout(layout);
- appender->activateOptions(p);
+ appender->activateOptions();
logger->addAppender(appender);
logger->setLevel(Level::getInfo());
diff --git a/src/test/cpp/fileappendertest.cpp
b/src/test/cpp/fileappendertest.cpp
index 979bfb78..1c874b46 100644
--- a/src/test/cpp/fileappendertest.cpp
+++ b/src/test/cpp/fileappendertest.cpp
@@ -40,8 +40,7 @@ auto getLogger(const LogString& name = {}) -> LoggerPtr {
writer->setName(LOG4CXX_STR("FileAppender"));
writer->setBufferedIO(true);
writer->setBufferedSeconds(1);
- helpers::Pool p;
- writer->activateOptions(p);
+ writer->activateOptions();
BasicConfigurator::configure(writer);
}
~log4cxx_initializer() {
@@ -95,8 +94,7 @@ public:
FileAppenderPtr wa(new FileAppender());
wa->setFile(LOG4CXX_STR("output/newdir/temp.log"));
wa->setLayout(PatternLayoutPtr(new
PatternLayout(LOG4CXX_STR("%m%n"))));
- Pool p;
- wa->activateOptions(p);
+ wa->activateOptions();
LOGUNIT_ASSERT(File(LOG4CXX_STR("output/newdir/temp.log")).exists());
}
@@ -172,8 +170,7 @@ public:
auto policy =
std::make_shared<rolling::TimeBasedRollingPolicy>();
policy->setFileNamePattern(dir +
LOG4CXX_STR("/100message-%d{yyyy}.log"));
writer->setRollingPolicy(policy);
- helpers::Pool p;
- writer->activateOptions(p);
+ writer->activateOptions();
logger->setAdditivity(false);
logger->addAppender(writer);
diff --git a/src/test/cpp/filter/andfiltertest.cpp
b/src/test/cpp/filter/andfiltertest.cpp
index 96defe46..5e4ae6f0 100644
--- a/src/test/cpp/filter/andfiltertest.cpp
+++ b/src/test/cpp/filter/andfiltertest.cpp
@@ -58,8 +58,7 @@ public:
LOG4CXX_STR("Hello, World"),
LOG4CXX_LOCATION));
FilterPtr filter(new AndFilter());
- Pool p;
- filter->activateOptions(p);
+ filter->activateOptions();
LOGUNIT_ASSERT_EQUAL(Filter::ACCEPT, filter->decide(event));
}
@@ -77,10 +76,9 @@ public:
AndFilterPtr filter(new AndFilter());
LevelMatchFilterPtr filter1(new LevelMatchFilter());
filter1->setLevelToMatch(LOG4CXX_STR("info"));
- Pool p;
- filter1->activateOptions(p);
+ filter1->activateOptions();
filter->addFilter(filter1);
- filter->activateOptions(p);
+ filter->activateOptions();
LOGUNIT_ASSERT_EQUAL(Filter::ACCEPT, filter->decide(event));
}
@@ -98,14 +96,13 @@ public:
AndFilterPtr filter(new AndFilter());
LevelMatchFilterPtr filter1(new LevelMatchFilter());
filter1->setLevelToMatch(LOG4CXX_STR("info"));
- Pool p;
- filter1->activateOptions(p);
+ filter1->activateOptions();
filter->addFilter(filter1);
LevelMatchFilterPtr filter2(new LevelMatchFilter());
filter2->setLevelToMatch(LOG4CXX_STR("info"));
- filter2->activateOptions(p);
+ filter2->activateOptions();
filter->addFilter(filter2);
- filter->activateOptions(p);
+ filter->activateOptions();
LOGUNIT_ASSERT_EQUAL(Filter::ACCEPT, filter->decide(event));
}
@@ -124,11 +121,10 @@ public:
AndFilterPtr filter(new AndFilter());
LevelMatchFilterPtr filter1(new LevelMatchFilter());
filter1->setLevelToMatch(LOG4CXX_STR("info"));
- Pool p;
- filter1->activateOptions(p);
+ filter1->activateOptions();
filter->addFilter(filter1);
filter->setAcceptOnMatch(false);
- filter->activateOptions(p);
+ filter->activateOptions();
LOGUNIT_ASSERT_EQUAL(Filter::DENY, filter->decide(event));
}
@@ -146,13 +142,12 @@ public:
AndFilterPtr filter(new AndFilter());
LevelMatchFilterPtr filter1(new LevelMatchFilter());
filter1->setLevelToMatch(LOG4CXX_STR("info"));
- Pool p;
- filter1->activateOptions(p);
+ filter1->activateOptions();
filter->addFilter(filter1);
FilterPtr filter2(new DenyAllFilter());
- filter2->activateOptions(p);
+ filter2->activateOptions();
filter->addFilter(filter2);
- filter->activateOptions(p);
+ filter->activateOptions();
LOGUNIT_ASSERT_EQUAL(Filter::NEUTRAL, filter->decide(event));
}
@@ -170,13 +165,12 @@ public:
AndFilterPtr filter(new AndFilter());
LevelMatchFilterPtr filter1(new LevelMatchFilter());
filter1->setLevelToMatch(LOG4CXX_STR("info"));
- Pool p;
- filter1->activateOptions(p);
+ filter1->activateOptions();
filter->addFilter(filter1);
FilterPtr filter2(new StringMatchFilter());
- filter2->activateOptions(p);
+ filter2->activateOptions();
filter->addFilter(filter2);
- filter->activateOptions(p);
+ filter->activateOptions();
LOGUNIT_ASSERT_EQUAL(Filter::NEUTRAL, filter->decide(event));
}
};
diff --git a/src/test/cpp/filter/denyallfiltertest.cpp
b/src/test/cpp/filter/denyallfiltertest.cpp
index 1ff1f7b8..492263bc 100644
--- a/src/test/cpp/filter/denyallfiltertest.cpp
+++ b/src/test/cpp/filter/denyallfiltertest.cpp
@@ -47,8 +47,7 @@ public:
LOG4CXX_STR("Hello, World"),
LOG4CXX_LOCATION));
FilterPtr filter(new DenyAllFilter());
- Pool p;
- filter->activateOptions(p);
+ filter->activateOptions();
LOGUNIT_ASSERT_EQUAL(Filter::DENY, filter->decide(event));
}
diff --git a/src/test/cpp/filter/levelmatchfiltertest.cpp
b/src/test/cpp/filter/levelmatchfiltertest.cpp
index 3acbb8ff..ede25240 100644
--- a/src/test/cpp/filter/levelmatchfiltertest.cpp
+++ b/src/test/cpp/filter/levelmatchfiltertest.cpp
@@ -52,8 +52,7 @@ public:
LOG4CXX_LOCATION));
LevelMatchFilterPtr filter(new LevelMatchFilter());
filter->setLevelToMatch(LOG4CXX_STR("info"));
- Pool p;
- filter->activateOptions(p);
+ filter->activateOptions();
LOGUNIT_ASSERT_EQUAL(Filter::ACCEPT, filter->decide(event));
}
@@ -71,8 +70,7 @@ public:
LevelMatchFilterPtr filter(new LevelMatchFilter());
filter->setLevelToMatch(LOG4CXX_STR("info"));
filter->setAcceptOnMatch(false);
- Pool p;
- filter->activateOptions(p);
+ filter->activateOptions();
LOGUNIT_ASSERT_EQUAL(Filter::DENY, filter->decide(event));
}
@@ -88,8 +86,7 @@ public:
LOG4CXX_STR("Hello, World"),
LOG4CXX_LOCATION));
LevelMatchFilterPtr filter(new LevelMatchFilter());
- Pool p;
- filter->activateOptions(p);
+ filter->activateOptions();
LOGUNIT_ASSERT_EQUAL(Filter::NEUTRAL, filter->decide(event));
}
@@ -106,8 +103,7 @@ public:
LOG4CXX_LOCATION));
LevelMatchFilterPtr filter(new LevelMatchFilter());
filter->setLevelToMatch(LOG4CXX_STR("debug"));
- Pool p;
- filter->activateOptions(p);
+ filter->activateOptions();
LOGUNIT_ASSERT_EQUAL(Filter::NEUTRAL, filter->decide(event));
}
@@ -124,8 +120,7 @@ public:
LOG4CXX_LOCATION));
LevelMatchFilterPtr filter(new LevelMatchFilter());
filter->setLevelToMatch(LOG4CXX_STR("warn"));
- Pool p;
- filter->activateOptions(p);
+ filter->activateOptions();
LOGUNIT_ASSERT_EQUAL(Filter::NEUTRAL, filter->decide(event));
}
};
diff --git a/src/test/cpp/filter/levelrangefiltertest.cpp
b/src/test/cpp/filter/levelrangefiltertest.cpp
index f0971f64..153b3702 100644
--- a/src/test/cpp/filter/levelrangefiltertest.cpp
+++ b/src/test/cpp/filter/levelrangefiltertest.cpp
@@ -54,8 +54,7 @@ public:
LOG4CXX_LOCATION));
LevelRangeFilterPtr filter(new LevelRangeFilter());
filter->setLevelMin(Level::getWarn());
- Pool p;
- filter->activateOptions(p);
+ filter->activateOptions();
LOGUNIT_ASSERT_EQUAL(Filter::DENY, filter->decide(event));
}
@@ -72,8 +71,7 @@ public:
LOG4CXX_LOCATION));
LevelRangeFilterPtr filter(new LevelRangeFilter());
filter->setLevelMax(Level::getDebug());
- Pool p;
- filter->activateOptions(p);
+ filter->activateOptions();
LOGUNIT_ASSERT_EQUAL(Filter::DENY, filter->decide(event));
}
@@ -91,8 +89,7 @@ public:
LevelRangeFilterPtr filter(new LevelRangeFilter());
filter->setLevelMin(Level::getDebug());
filter->setAcceptOnMatch(true);
- Pool p;
- filter->activateOptions(p);
+ filter->activateOptions();
LOGUNIT_ASSERT_EQUAL(Filter::ACCEPT, filter->decide(event));
}
@@ -110,8 +107,7 @@ public:
LevelRangeFilterPtr filter(new LevelRangeFilter());
filter->setLevelMax(Level::getError());
filter->setAcceptOnMatch(true);
- Pool p;
- filter->activateOptions(p);
+ filter->activateOptions();
LOGUNIT_ASSERT_EQUAL(Filter::ACCEPT, filter->decide(event));
}
@@ -128,8 +124,7 @@ public:
LOG4CXX_LOCATION));
LevelRangeFilterPtr filter(new LevelRangeFilter());
filter->setLevelMin(Level::getDebug());
- Pool p;
- filter->activateOptions(p);
+ filter->activateOptions();
LOGUNIT_ASSERT_EQUAL(Filter::NEUTRAL, filter->decide(event));
}
@@ -146,8 +141,7 @@ public:
LOG4CXX_LOCATION));
LevelRangeFilterPtr filter(new LevelRangeFilter());
filter->setLevelMax(Level::getError());
- Pool p;
- filter->activateOptions(p);
+ filter->activateOptions();
LOGUNIT_ASSERT_EQUAL(Filter::NEUTRAL, filter->decide(event));
}
};
diff --git a/src/test/cpp/filter/locationinfofiltertest.cpp
b/src/test/cpp/filter/locationinfofiltertest.cpp
index 402b97a5..edef692f 100644
--- a/src/test/cpp/filter/locationinfofiltertest.cpp
+++ b/src/test/cpp/filter/locationinfofiltertest.cpp
@@ -55,8 +55,7 @@ public:
LOG4CXX_STR("Hello, World"),
li));
FilterPtr filter(new LocationInfoFilter());
- Pool p;
- filter->activateOptions(p);
+ filter->activateOptions();
LOGUNIT_ASSERT_EQUAL(Filter::NEUTRAL, filter->decide(event));
}
@@ -77,8 +76,7 @@ public:
li));
LocationInfoFilterPtr filter(new LocationInfoFilter());
filter->setLineNumber(10);
- Pool p;
- filter->activateOptions(p);
+ filter->activateOptions();
LOGUNIT_ASSERT_EQUAL(Filter::NEUTRAL, filter->decide(event));
}
@@ -100,8 +98,7 @@ public:
LocationInfoFilterPtr filter(new LocationInfoFilter());
filter->setLineNumber(50);
filter->setAcceptOnMatch(true);
- Pool p;
- filter->activateOptions(p);
+ filter->activateOptions();
LOGUNIT_ASSERT_EQUAL(Filter::ACCEPT, filter->decide(event));
}
@@ -125,8 +122,7 @@ public:
filter->setMethodName(LOG4CXX_STR("exampleFun"));
filter->setAcceptOnMatch(true);
filter->setMustMatchAll(true);
- Pool p;
- filter->activateOptions(p);
+ filter->activateOptions();
LOGUNIT_ASSERT_EQUAL(Filter::ACCEPT, filter->decide(event));
}
diff --git a/src/test/cpp/filter/loggermatchfiltertest.cpp
b/src/test/cpp/filter/loggermatchfiltertest.cpp
index 88adb06b..4e5b9a65 100644
--- a/src/test/cpp/filter/loggermatchfiltertest.cpp
+++ b/src/test/cpp/filter/loggermatchfiltertest.cpp
@@ -51,8 +51,7 @@ public:
LOG4CXX_STR("Hello, World"),
LOG4CXX_LOCATION));
FilterPtr filter(new LoggerMatchFilter());
- Pool p;
- filter->activateOptions(p);
+ filter->activateOptions();
LOGUNIT_ASSERT_EQUAL(Filter::ACCEPT, filter->decide(event));
}
@@ -69,8 +68,7 @@ public:
LOG4CXX_LOCATION));
LoggerMatchFilterPtr filter(new LoggerMatchFilter());
filter->setAcceptOnMatch(false);
- Pool p;
- filter->activateOptions(p);
+ filter->activateOptions();
LOGUNIT_ASSERT_EQUAL(Filter::DENY, filter->decide(event));
}
@@ -86,8 +84,7 @@ public:
LOG4CXX_STR("Hello, World"),
LOG4CXX_LOCATION));
FilterPtr filter(new LoggerMatchFilter());
- Pool p;
- filter->activateOptions(p);
+ filter->activateOptions();
LOGUNIT_ASSERT_EQUAL(Filter::NEUTRAL, filter->decide(event));
}
@@ -104,8 +101,7 @@ public:
LOG4CXX_LOCATION));
LoggerMatchFilterPtr filter(new LoggerMatchFilter());
filter->setLoggerToMatch(LOG4CXX_STR("org.apache.log4j.filter.LoggerMatchFilterTest"));
- Pool p;
- filter->activateOptions(p);
+ filter->activateOptions();
LOGUNIT_ASSERT_EQUAL(Filter::ACCEPT, filter->decide(event));
}
diff --git a/src/test/cpp/filter/mapfiltertest.cpp
b/src/test/cpp/filter/mapfiltertest.cpp
index 0b3d620d..10bf768b 100644
--- a/src/test/cpp/filter/mapfiltertest.cpp
+++ b/src/test/cpp/filter/mapfiltertest.cpp
@@ -51,8 +51,7 @@ public:
LOG4CXX_STR("Hello, World"),
LOG4CXX_LOCATION));
FilterPtr filter(new MapFilter());
- Pool p;
- filter->activateOptions(p);
+ filter->activateOptions();
LOGUNIT_ASSERT_EQUAL(Filter::NEUTRAL, filter->decide(event));
}
@@ -70,8 +69,7 @@ public:
MDC::put(LOG4CXX_STR("my.ip"), LOG4CXX_STR("localhost"));
MapFilterPtr filter(new MapFilter());
filter->setKeyValue(LOG4CXX_STR("my.ip"),
LOG4CXX_STR("127.0.0.1"));
- Pool p;
- filter->activateOptions(p);
+ filter->activateOptions();
filter->setAcceptOnMatch(true);
LOGUNIT_ASSERT_EQUAL(Filter::NEUTRAL, filter->decide(event));
@@ -94,8 +92,7 @@ public:
MDC::put(LOG4CXX_STR("my.ip"), LOG4CXX_STR("127.0.0.1"));
MapFilterPtr filter(new MapFilter());
filter->setKeyValue(LOG4CXX_STR("my.ip"),
LOG4CXX_STR("127.0.0.1"));
- Pool p;
- filter->activateOptions(p);
+ filter->activateOptions();
filter->setAcceptOnMatch(true);
LOGUNIT_ASSERT_EQUAL(Filter::ACCEPT, filter->decide(event));
@@ -121,8 +118,7 @@ public:
filter->setKeyValue(LOG4CXX_STR("my.ip"),
LOG4CXX_STR("127.0.0.1"));
filter->setKeyValue(LOG4CXX_STR("my.name"),
LOG4CXX_STR("Unknown"));
filter->setAcceptOnMatch(true);
- Pool p;
- filter->activateOptions(p);
+ filter->activateOptions();
filter->setMustMatchAll(true); // AND T/F
LOGUNIT_ASSERT_EQUAL(Filter::NEUTRAL, filter->decide(event));
// does not match second
diff --git a/src/test/cpp/filter/stringmatchfiltertest.cpp
b/src/test/cpp/filter/stringmatchfiltertest.cpp
index 131d0edb..b1c2c0b0 100644
--- a/src/test/cpp/filter/stringmatchfiltertest.cpp
+++ b/src/test/cpp/filter/stringmatchfiltertest.cpp
@@ -52,8 +52,7 @@ public:
LOG4CXX_STR("Hello, World"),
LOG4CXX_LOCATION));
FilterPtr filter(new StringMatchFilter());
- Pool p;
- filter->activateOptions(p);
+ filter->activateOptions();
LOGUNIT_ASSERT_EQUAL(Filter::NEUTRAL, filter->decide(event));
}
@@ -70,8 +69,7 @@ public:
LOG4CXX_LOCATION));
StringMatchFilterPtr filter(new StringMatchFilter());
filter->setStringToMatch(LOG4CXX_STR("Monde"));
- Pool p;
- filter->activateOptions(p);
+ filter->activateOptions();
LOGUNIT_ASSERT_EQUAL(Filter::NEUTRAL, filter->decide(event));
}
@@ -88,8 +86,7 @@ public:
LOG4CXX_LOCATION));
StringMatchFilterPtr filter(new StringMatchFilter());
filter->setStringToMatch(LOG4CXX_STR("World"));
- Pool p;
- filter->activateOptions(p);
+ filter->activateOptions();
LOGUNIT_ASSERT_EQUAL(Filter::ACCEPT, filter->decide(event));
}
@@ -108,8 +105,7 @@ public:
StringMatchFilterPtr filter(new StringMatchFilter());
filter->setStringToMatch(LOG4CXX_STR("World"));
filter->setAcceptOnMatch(false);
- Pool p;
- filter->activateOptions(p);
+ filter->activateOptions();
LOGUNIT_ASSERT_EQUAL(Filter::DENY, filter->decide(event));
}
@@ -126,8 +122,7 @@ public:
LOG4CXX_LOCATION));
StringMatchFilterPtr filter(new StringMatchFilter());
filter->setStringToMatch(LOG4CXX_STR("world"));
- Pool p;
- filter->activateOptions(p);
+ filter->activateOptions();
LOGUNIT_ASSERT_EQUAL(Filter::NEUTRAL, filter->decide(event));
}
diff --git a/src/test/cpp/multithreadtest.cpp b/src/test/cpp/multithreadtest.cpp
index b7cad390..b396096a 100644
--- a/src/test/cpp/multithreadtest.cpp
+++ b/src/test/cpp/multithreadtest.cpp
@@ -54,8 +54,7 @@ public:
setLayout(std::make_shared<PatternLayout>(LOG4CXX_STR("%d [%t]
%-5p %.16c - %m%n")));
setAppend(false);
setBufferedIO(true);
- helpers::Pool p;
- activateOptions(p);
+ activateOptions();
}
};
#endif
diff --git a/src/test/cpp/net/socketappendertestcase.cpp
b/src/test/cpp/net/socketappendertestcase.cpp
index b3e42a6f..4a67661e 100644
--- a/src/test/cpp/net/socketappendertestcase.cpp
+++ b/src/test/cpp/net/socketappendertestcase.cpp
@@ -72,8 +72,7 @@ class SocketAppenderTestCase : public AppenderSkeletonTestCase
appender->setRemoteHost(LOG4CXX_STR("localhost"));
appender->setReconnectionDelay(50); // milliseconds
appender->setPort(tcpPort);
- helpers::Pool pool;
- appender->activateOptions(pool);
+ appender->activateOptions();
BasicConfigurator::configure(appender);
diff --git a/src/test/cpp/net/telnetappendertestcase.cpp
b/src/test/cpp/net/telnetappendertestcase.cpp
index ace88a95..93ac1958 100644
--- a/src/test/cpp/net/telnetappendertestcase.cpp
+++ b/src/test/cpp/net/telnetappendertestcase.cpp
@@ -74,8 +74,7 @@ class TelnetAppenderTestCase : public AppenderSkeletonTestCase
TelnetAppenderPtr appender(new TelnetAppender());
appender->setLayout(createLayout());
appender->setPort(TEST_PORT);
- Pool p;
- appender->activateOptions(p);
+ appender->activateOptions();
appender->close();
}
@@ -84,8 +83,7 @@ class TelnetAppenderTestCase : public AppenderSkeletonTestCase
TelnetAppenderPtr appender(new TelnetAppender());
appender->setLayout(createLayout());
appender->setPort(TEST_PORT);
- Pool p;
- appender->activateOptions(p);
+ appender->activateOptions();
apr_sleep(100000); // 100 milliseconds
appender->close();
}
@@ -100,8 +98,7 @@ class TelnetAppenderTestCase : public
AppenderSkeletonTestCase
appender->setPort(TEST_PORT);
appender->setReuseAddress(true);
appender->setNonBlocking(true);
- Pool p;
- appender->activateOptions(p);
+ appender->activateOptions();
BasicConfigurator::configure(appender);
auto root = Logger::getRootLogger();
@@ -124,8 +121,7 @@ class TelnetAppenderTestCase : public
AppenderSkeletonTestCase
appender->setMaxConnections(1);
appender->setReuseAddress(true);
appender->setHostname(LOG4CXX_STR("127.0.0.1"));
- Pool p;
- appender->activateOptions(p);
+ appender->activateOptions();
BasicConfigurator::configure(appender);
auto root = Logger::getRootLogger();
diff --git a/src/test/cpp/nt/nteventlogappendertestcase.cpp
b/src/test/cpp/nt/nteventlogappendertestcase.cpp
index b4b82115..01bd6101 100644
--- a/src/test/cpp/nt/nteventlogappendertestcase.cpp
+++ b/src/test/cpp/nt/nteventlogappendertestcase.cpp
@@ -83,7 +83,7 @@ class NTEventLogAppenderTestCase : public
AppenderSkeletonTestCase
appender->setSource(LOG4CXX_STR("log4cxx_test"));
LayoutPtr layout(new
PatternLayout(LOG4CXX_STR("%c - %m%n")));
appender->setLayout(layout);
- appender->activateOptions(p);
+ appender->activateOptions();
LoggingEventPtr event(new LoggingEvent(
LOG4CXX_STR("org.foobar"),
Level::getInfo(), LOG4CXX_STR("Hello, World"), LOG4CXX_LOCATION));
diff --git a/src/test/cpp/optionhandlertest.cpp
b/src/test/cpp/optionhandlertest.cpp
new file mode 100644
index 00000000..959a8104
--- /dev/null
+++ b/src/test/cpp/optionhandlertest.cpp
@@ -0,0 +1,184 @@
+/*
+ * 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.
+ */
+
+#include "logunit.h"
+#include <log4cxx/appenderskeleton.h>
+#include <log4cxx/helpers/pool.h>
+#include <log4cxx/helpers/loglog.h>
+#include <log4cxx/helpers/transcoder.h>
+
+using namespace log4cxx;
+
+/**
+ * Tests activateOptions in ABI 15 and 16.
+ *
+ */
+
+class ABI_15_Appender : public AppenderSkeleton
+{
+public:
+ void close() override
+ {}
+
+ void append(const spi::LoggingEventPtr& /*event*/, helpers::Pool&
/*p*/) override
+ {
+ helpers::LogLog::debug(LOG4CXX_STR("ABI_15_Appender::append"));
+ }
+
+ bool requiresLayout() const override
+ {
+ return false;
+ }
+
+ void activateOptions(helpers::Pool& p)
+ {
+
helpers::LogLog::debug(LOG4CXX_STR("ABI_15_Appender::activateOptions"));
+ AppenderSkeleton::activateOptions(p);
+ m_activated = true;
+ }
+
+ bool isActivated() const
+ {
+ return m_activated;
+ }
+private:
+ bool m_activated{ false };
+};
+
+
+class BaseAppender : public AppenderSkeleton
+{
+public:
+ void close() override
+ {}
+
+ void append(const spi::LoggingEventPtr& /*event*/, helpers::Pool&
/*p*/) override
+ {
+ helpers::LogLog::debug(LOG4CXX_STR("BaseAppender::append"));
+ }
+
+ bool requiresLayout() const override
+ {
+ return false;
+ }
+
+ using AppenderSkeleton::activateOptions;
+ void activateOptions( LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS )
override
+ {
+
helpers::LogLog::debug(LOG4CXX_STR("BaseAppender::activateOptions"));
+ AppenderSkeleton::activateOptions(
LOG4CXX_ACTIVATE_OPTIONS_PARAMETER );
+ m_activated = true;
+ }
+
+ bool isActivated() const
+ {
+ return m_activated;
+ }
+private:
+ bool m_activated{ false };
+};
+
+class ABI_15_Specialized_Appender : public BaseAppender
+{
+public:
+ // void activateOptions(helpers::Pool& p) override --> compiler error:
'ABI_15_Specialized_Appender::activateOptions': method with override specifier
'override' did not override any base class methods
+ //
'log4cxx::spi::OptionHandler::activateOptions': Use activateOptions() without
parameters instead
+ void activateOptions(helpers::Pool& p)
+ {
+
helpers::LogLog::debug(LOG4CXX_STR("ABI_15_Specialized_Appender::activateOptions"));
+ BaseAppender::activateOptions(p); // --> compiler warning:
'log4cxx::spi::OptionHandler::activateOptions': Use activateOptions() without
parameters instead
+ m_activated = true;
+ }
+
+ bool isActivated() const
+ {
+ return BaseAppender::isActivated() && m_activated;
+ }
+private:
+ bool m_activated{ false };
+};
+
+#if 15 < LOG4CXX_ABI_VERSION
+class ABI_16_Appender : public BaseAppender
+{
+public:
+ void activateOptions() override
+ {
+
helpers::LogLog::debug(LOG4CXX_STR("ABI_16_Appender::activateOptions"));
+ BaseAppender::activateOptions();
+ m_activated = true;
+ }
+
+ bool isActivated() const
+ {
+ return BaseAppender::isActivated() && m_activated;
+ }
+private:
+ bool m_activated{ false };
+};
+
+#endif
+
+LOGUNIT_CLASS(OptionHandlerTest)
+{
+ LOGUNIT_TEST_SUITE(OptionHandlerTest);
+ LOGUNIT_TEST(ABI_15_AppenderTest);
+ LOGUNIT_TEST(ABI_15_Specialized_AppenderTest);
+#if 15 < LOG4CXX_ABI_VERSION
+ LOGUNIT_TEST(ABI_16_AppenderTest);
+#endif
+ LOGUNIT_TEST_SUITE_END();
+public:
+
+ /**
+ * Checks a simple user defined ABI 15 style appender still works
+ */
+ void ABI_15_AppenderTest()
+ {
+ helpers::Pool p;
+ ABI_15_Appender a15;
+ a15.activateOptions(p);
+ LOGUNIT_ASSERT(a15.isActivated());
+ }
+
+ /**
+ * Checks all levels of the appender heirarchy are activated
+ */
+ void ABI_15_Specialized_AppenderTest()
+ {
+ helpers::Pool p;
+ ABI_15_Specialized_Appender a15s;
+ a15s.activateOptions(p);
+ LOGUNIT_ASSERT(a15s.isActivated());
+ }
+
+#if 15 < LOG4CXX_ABI_VERSION
+ /**
+ * Checks all levels of the appender heirarchy are activated
+ */
+ void ABI_16_AppenderTest()
+ {
+ ABI_16_Appender a16;
+ a16.activateOptions();
+ LOGUNIT_ASSERT(a16.isActivated());
+ }
+#endif
+
+};
+
+LOGUNIT_TEST_SUITE_REGISTRATION(OptionHandlerTest);
+
diff --git a/src/test/cpp/patternlayouttest.cpp
b/src/test/cpp/patternlayouttest.cpp
index 6301519f..e0b104e3 100644
--- a/src/test/cpp/patternlayouttest.cpp
+++ b/src/test/cpp/patternlayouttest.cpp
@@ -505,54 +505,53 @@ public:
root->debug(LOG4CXX_TEST_STR("starting mdc pattern test"));
layout->setConversionPattern(mdcMsgPattern1);
- log4cxx::helpers::Pool pool;
- layout->activateOptions(pool);
+ layout->activateOptions();
root->debug(LOG4CXX_TEST_STR("empty mdc, no key specified in
pattern"));
layout->setConversionPattern(mdcMsgPattern2);
- layout->activateOptions(pool);
+ layout->activateOptions();
root->debug(LOG4CXX_TEST_STR("empty mdc, key1 in pattern"));
layout->setConversionPattern(mdcMsgPattern3);
- layout->activateOptions(pool);
+ layout->activateOptions();
root->debug(LOG4CXX_TEST_STR("empty mdc, key2 in pattern"));
layout->setConversionPattern(mdcMsgPattern4);
- layout->activateOptions(pool);
+ layout->activateOptions();
root->debug(LOG4CXX_TEST_STR("empty mdc, key3 in pattern"));
layout->setConversionPattern(mdcMsgPattern5);
- layout->activateOptions(pool);
+ layout->activateOptions();
root->debug(LOG4CXX_TEST_STR("empty mdc, key1, key2, and key3
in pattern"));
MDC::put(LOG4CXX_TEST_STR("key1"), LOG4CXX_TEST_STR("value1"));
MDC::put(LOG4CXX_TEST_STR("key2"), LOG4CXX_TEST_STR("value2"));
layout->setConversionPattern(mdcMsgPattern1);
- layout->activateOptions(pool);
+ layout->activateOptions();
root->debug(LOG4CXX_TEST_STR("filled mdc, no key specified in
pattern"));
layout->setConversionPattern(mdcMsgPattern2);
- layout->activateOptions(pool);
+ layout->activateOptions();
root->debug(LOG4CXX_TEST_STR("filled mdc, key1 in pattern"));
layout->setConversionPattern(mdcMsgPattern3);
- layout->activateOptions(pool);
+ layout->activateOptions();
root->debug(LOG4CXX_TEST_STR("filled mdc, key2 in pattern"));
layout->setConversionPattern(mdcMsgPattern4);
- layout->activateOptions(pool);
+ layout->activateOptions();
root->debug(LOG4CXX_TEST_STR("filled mdc, key3 in pattern"));
layout->setConversionPattern(mdcMsgPattern5);
- layout->activateOptions(pool);
+ layout->activateOptions();
root->debug(LOG4CXX_TEST_STR("filled mdc, key1, key2, and key3
in pattern"));
MDC::remove(LOG4CXX_TEST_STR("key1"));
MDC::remove(LOG4CXX_TEST_STR("key2"));
layout->setConversionPattern(LOG4CXX_STR("%m%n"));
- layout->activateOptions(pool);
+ layout->activateOptions();
root->debug(LOG4CXX_TEST_STR("finished mdc pattern test"));
LOGUNIT_ASSERT(Compare::compare(OUTPUT_FILE, WITNESS_FILE));
diff --git a/src/test/cpp/rolling/filterbasedrollingtest.cpp
b/src/test/cpp/rolling/filterbasedrollingtest.cpp
index bbff3fdc..534fa291 100644
--- a/src/test/cpp/rolling/filterbasedrollingtest.cpp
+++ b/src/test/cpp/rolling/filterbasedrollingtest.cpp
@@ -84,19 +84,18 @@ public:
rf->setLevelMin(Level::getInfo());
fbtp->addFilter(rf);
- Pool p;
- fbtp->activateOptions(p);
+ fbtp->activateOptions();
swrp->setMinIndex(0);
rfa->setFile(LOG4CXX_STR("output/filterBased-test2.log"));
rfa->setAppend(false);
swrp->setFileNamePattern(LOG4CXX_STR("output/filterBased-test2.%i"));
- swrp->activateOptions(p);
+ swrp->activateOptions();
rfa->setRollingPolicy(swrp);
rfa->setTriggeringPolicy(fbtp);
- rfa->activateOptions(p);
+ rfa->activateOptions();
Logger::getRootLogger()->addAppender(rfa);
Logger::getRootLogger()->setLevel(Level::getDebug());
diff --git a/src/test/cpp/rolling/manualrollingtest.cpp
b/src/test/cpp/rolling/manualrollingtest.cpp
index 19240b4e..eb7e54a2 100644
--- a/src/test/cpp/rolling/manualrollingtest.cpp
+++ b/src/test/cpp/rolling/manualrollingtest.cpp
@@ -120,14 +120,13 @@ public:
swrp->setMinIndex(0);
swrp->setFileNamePattern(LOG4CXX_STR("output/manual-test1.%i"));
- Pool p;
- swrp->activateOptions(p);
+ swrp->activateOptions();
rfa->setRollingPolicy(swrp);
- rfa->activateOptions(p);
+ rfa->activateOptions();
root->addAppender(rfa);
-
+ Pool p;
common(rfa, p, logger);
LOGUNIT_ASSERT_EQUAL(true,
File("output/manual-test1.0").exists());
@@ -153,10 +152,10 @@ public:
rfa->setLayout(layout);
rfa->setFile(LOG4CXX_STR("output/manual-test2.log"));
- Pool p;
- rfa->activateOptions(p);
+ rfa->activateOptions();
root->addAppender(rfa);
+ Pool p;
common(rfa, p, logger);
LOGUNIT_ASSERT_EQUAL(true,
File("output/manual-test2.log").exists());
@@ -187,9 +186,9 @@ public:
rfa->setFile(LOG4CXX_STR("output/manual-test3.log"));
fwrp->setFileNamePattern(LOG4CXX_STR("output/sbr-test3.%i.gz"));
Pool p;
- fwrp->activateOptions(p);
+ fwrp->activateOptions();
rfa->setRollingPolicy(fwrp);
- rfa->activateOptions(p);
+ rfa->activateOptions();
root->addAppender(rfa);
common(rfa, p, logger);
@@ -224,10 +223,10 @@ public:
//
swrp->setFileNamePattern(LOG4CXX_STR("output/test4/manual-test4.%i"));
Pool p;
- swrp->activateOptions(p);
+ swrp->activateOptions();
rfa->setRollingPolicy(swrp);
- rfa->activateOptions(p);
+ rfa->activateOptions();
root->addAppender(rfa);
common(rfa, p, logger);
@@ -256,15 +255,15 @@ public:
swrp->setMinIndex(0);
swrp->setFileNamePattern(LOG4CXX_STR("output/manual-test5.%i"));
- Pool p;
- swrp->activateOptions(p);
+ swrp->activateOptions();
rfa->setRollingPolicy(swrp);
- rfa->activateOptions(p);
+ rfa->activateOptions();
root->addAppender(rfa);
//
// put stray file about locked file
+ Pool p;
FileOutputStream os1(LOG4CXX_STR("output/manual-test5.1"),
false);
os1.close(p);
@@ -334,14 +333,14 @@ public:
LogString filenamePatternPrefix = filenamePattern;
filenamePattern.append( LOG4CXX_STR("/file-%i.gz") );
swrp->setFileNamePattern(filenamePattern);
- Pool p;
- swrp->activateOptions(p);
+ swrp->activateOptions();
rfa->setRollingPolicy(swrp);
- rfa->activateOptions(p);
+ rfa->activateOptions();
root->addAppender(rfa);
+ Pool p;
common(rfa, p, logger);
LOGUNIT_ASSERT_EQUAL(true, File(filenamePatternPrefix +
LOG4CXX_STR("/file-0.gz")).exists());
diff --git a/src/test/cpp/rolling/rollingfileappenderpropertiestest.cpp
b/src/test/cpp/rolling/rollingfileappenderpropertiestest.cpp
index bf4eb8f7..beb52ccd 100644
--- a/src/test/cpp/rolling/rollingfileappenderpropertiestest.cpp
+++ b/src/test/cpp/rolling/rollingfileappenderpropertiestest.cpp
@@ -117,8 +117,7 @@ public:
rfa->setOption(LOG4CXX_STR("append"), LOG4CXX_STR("false"));
rfa->setMaximumFileSize(100);
rfa->setFile(LOG4CXX_STR("output/obsoleteRFA-test2.log"));
- Pool p;
- rfa->activateOptions(p);
+ rfa->activateOptions();
auto root = Logger::getRootLogger();
root->addAppender(rfa);
@@ -184,8 +183,7 @@ public:
rfa->setAppend(false);
rfa->setFile(LOG4CXX_STR("output/obsoleteDRFA-test2.log"));
rfa->setDatePattern(LOG4CXX_STR("'.'yyyy-MM-dd-HH_mm_ss"));
- Pool p;
- rfa->activateOptions(p);
+ rfa->activateOptions();
LoggerPtr root(Logger::getRootLogger());
root->addAppender(rfa);
LoggerPtr
logger(Logger::getLogger("ObsoleteDailyRollingAppenderTest"));
diff --git a/src/test/cpp/rolling/sizebasedrollingtest.cpp
b/src/test/cpp/rolling/sizebasedrollingtest.cpp
index 63c9b85c..33018a9f 100644
--- a/src/test/cpp/rolling/sizebasedrollingtest.cpp
+++ b/src/test/cpp/rolling/sizebasedrollingtest.cpp
@@ -118,12 +118,11 @@ public:
swrp->setMinIndex(0);
swrp->setFileNamePattern(LOG4CXX_STR("output/sizeBased-test1.%i"));
- Pool p;
- swrp->activateOptions(p);
+ swrp->activateOptions();
rfa->setRollingPolicy(swrp);
rfa->setTriggeringPolicy(sbtp);
- rfa->activateOptions(p);
+ rfa->activateOptions();
root->addAppender(rfa);
@@ -159,12 +158,11 @@ public:
swrp->setMinIndex(0);
swrp->setFileNamePattern(LOG4CXX_STR("output/sizeBased-test2.%i"));
- Pool p;
- swrp->activateOptions(p);
+ swrp->activateOptions();
rfa->setRollingPolicy(swrp);
rfa->setTriggeringPolicy(sbtp);
- rfa->activateOptions(p);
+ rfa->activateOptions();
root->addAppender(rfa);
common(logger, 0);
@@ -198,11 +196,10 @@ public:
fwrp->setMinIndex(0);
rfa->setFile(LOG4CXX_STR("output/sbr-test3.log"));
fwrp->setFileNamePattern(LOG4CXX_STR("output/sbr-test3.%i.gz"));
- Pool p;
- fwrp->activateOptions(p);
+ fwrp->activateOptions();
rfa->setRollingPolicy(fwrp);
rfa->setTriggeringPolicy(sbtp);
- rfa->activateOptions(p);
+ rfa->activateOptions();
root->addAppender(rfa);
common(logger, 100);
@@ -238,12 +235,11 @@ public:
// test4 directory should not exists. Should cause all
rollover attempts to fail.
//
swrp->setFileNamePattern(LOG4CXX_STR("output/test4/sizeBased-test4.%i"));
- Pool p;
- swrp->activateOptions(p);
+ swrp->activateOptions();
rfa->setRollingPolicy(swrp);
rfa->setTriggeringPolicy(sbtp);
- rfa->activateOptions(p);
+ rfa->activateOptions();
root->addAppender(rfa);
common(logger, 0);
@@ -274,16 +270,16 @@ public:
swrp->setMinIndex(0);
swrp->setFileNamePattern(LOG4CXX_STR("output/sizeBased-test5.%i"));
- Pool p;
- swrp->activateOptions(p);
+ swrp->activateOptions();
rfa->setRollingPolicy(swrp);
rfa->setTriggeringPolicy(sbtp);
- rfa->activateOptions(p);
+ rfa->activateOptions();
root->addAppender(rfa);
//
// put stray file about locked file
+ Pool p;
FileOutputStream os1(LOG4CXX_STR("output/sizeBased-test5.1"),
false);
os1.close(p);
@@ -346,11 +342,10 @@ public:
fwrp->setMinIndex(0);
rfa->setFile(LOG4CXX_STR("output/sbr-test6.log"));
fwrp->setFileNamePattern(LOG4CXX_STR("output/sbr-test6.%i.zip"));
- Pool p;
- fwrp->activateOptions(p);
+ fwrp->activateOptions();
rfa->setRollingPolicy(fwrp);
rfa->setTriggeringPolicy(sbtp);
- rfa->activateOptions(p);
+ rfa->activateOptions();
root->addAppender(rfa);
common(logger, 100);
diff --git a/src/test/cpp/rolling/timebasedrollingtest.cpp
b/src/test/cpp/rolling/timebasedrollingtest.cpp
index 1ae076b1..bd5a3bea 100644
--- a/src/test/cpp/rolling/timebasedrollingtest.cpp
+++ b/src/test/cpp/rolling/timebasedrollingtest.cpp
@@ -394,7 +394,6 @@ public:
*/
void test1()
{
- Pool pool;
const int nrOfFnames(4);
LogString fnames[nrOfFnames];
@@ -405,11 +404,12 @@ public:
TimeBasedRollingPolicyPtr tbrp(new TimeBasedRollingPolicy());
tbrp->setFileNamePattern(LOG4CXX_STR("" DIR_PRE_OUTPUT
"test1-%d{" DATE_PATTERN "}"));
- tbrp->activateOptions(pool);
+ tbrp->activateOptions();
rfa->setRollingPolicy(tbrp);
- rfa->activateOptions(pool);
+ rfa->activateOptions();
logger->addAppender(rfa);
+ Pool pool;
this->buildTsFnames<4>(pool, LOG4CXX_STR("test1-"), fnames);
this->delayUntilNextSecondWithMsg();
this->logMsgAndSleep( pool, nrOfFnames + 1, __LOG4CXX_FUNC__,
__LINE__);
@@ -422,7 +422,6 @@ public:
*/
void test2()
{
- Pool pool;
const int nrOfFnames(4);
LogString fnames[nrOfFnames];
@@ -433,11 +432,12 @@ public:
TimeBasedRollingPolicyPtr tbrp1(new TimeBasedRollingPolicy());
tbrp1->setFileNamePattern(LOG4CXX_STR("" DIR_PRE_OUTPUT
"test2-%d{" DATE_PATTERN "}"));
- tbrp1->activateOptions(pool);
+ tbrp1->activateOptions();
rfa1->setRollingPolicy(tbrp1);
- rfa1->activateOptions(pool);
+ rfa1->activateOptions();
logger->addAppender(rfa1);
+ Pool pool;
this->buildTsFnames<4>(pool, LOG4CXX_STR("test2-"), fnames);
this->delayUntilNextSecondWithMsg();
this->logMsgAndSleep(pool, 3, __LOG4CXX_FUNC__, __LINE__);
@@ -451,9 +451,9 @@ public:
TimeBasedRollingPolicyPtr tbrp2 = TimeBasedRollingPolicyPtr(new
TimeBasedRollingPolicy());
tbrp2->setFileNamePattern(LOG4CXX_STR("" DIR_PRE_OUTPUT
"test2-%d{" DATE_PATTERN "}"));
- tbrp2->activateOptions(pool);
+ tbrp2->activateOptions();
rfa2->setRollingPolicy(tbrp2);
- rfa2->activateOptions(pool);
+ rfa2->activateOptions();
rfa2->setAppend(false);
logger->addAppender(rfa2);
@@ -467,7 +467,6 @@ public:
*/
void test3()
{
- Pool pool;
const int nrOfFnames(4);
LogString fnames[nrOfFnames];
@@ -478,11 +477,12 @@ public:
TimeBasedRollingPolicyPtr tbrp = TimeBasedRollingPolicyPtr(new
TimeBasedRollingPolicy());
tbrp->setFileNamePattern(LogString(LOG4CXX_STR(""
DIR_PRE_OUTPUT "test3-%d{" DATE_PATTERN "}.gz")));
- tbrp->activateOptions(pool);
+ tbrp->activateOptions();
rfa->setRollingPolicy(tbrp);
- rfa->activateOptions(pool);
+ rfa->activateOptions();
logger->addAppender(rfa);
+ Pool pool;
this->buildTsFnames<4>(pool, LOG4CXX_STR("test3-"), fnames,
true);
fnames[nrOfFnames - 1].resize(fnames[nrOfFnames - 1].size() -
3);
this->delayUntilNextSecondWithMsg();
@@ -499,7 +499,6 @@ public:
*/
void test4()
{
- Pool pool;
const int nrOfFnames(4);
const int nrOfLogMsgs(((nrOfFnames - 1) * 2) - 1);
LogString fnames[nrOfFnames];
@@ -510,12 +509,13 @@ public:
TimeBasedRollingPolicyPtr tbrp1 = TimeBasedRollingPolicyPtr(new
TimeBasedRollingPolicy());
tbrp1->setFileNamePattern(LOG4CXX_STR("" DIR_PRE_OUTPUT
"test4-%d{" DATE_PATTERN "}"));
- tbrp1->activateOptions(pool);
+ tbrp1->activateOptions();
rfa1->setFile(LOG4CXX_STR("" DIR_PRE_OUTPUT "test4.log"));
rfa1->setRollingPolicy(tbrp1);
- rfa1->activateOptions(pool);
+ rfa1->activateOptions();
logger->addAppender(rfa1);
+ Pool pool;
this->delGenericLogFile(pool, rfa1->getFile());
this->buildTsFnames<4>(pool, LOG4CXX_STR("test4-"), fnames);
fnames[0].assign(rfa1->getFile());
@@ -531,10 +531,10 @@ public:
TimeBasedRollingPolicyPtr tbrp2 = TimeBasedRollingPolicyPtr(new
TimeBasedRollingPolicy());
tbrp2->setFileNamePattern(LOG4CXX_STR("" DIR_PRE_OUTPUT
"test4-%d{" DATE_PATTERN "}"));
- tbrp2->activateOptions(pool);
+ tbrp2->activateOptions();
rfa2->setFile(rfa1->getFile());
rfa2->setRollingPolicy(tbrp2);
- rfa2->activateOptions(pool);
+ rfa2->activateOptions();
logger->addAppender(rfa2);
// The one file not checked is the active file from the old
appender reused by the new one
@@ -552,7 +552,6 @@ public:
*/
void test5()
{
- Pool pool;
const int nrOfFnames(4);
const int nrOfLogMsgs((nrOfFnames * 2) - 1);
LogString fnames[nrOfFnames];
@@ -565,11 +564,12 @@ public:
tbrp->setFileNamePattern(LOG4CXX_STR("" DIR_PRE_OUTPUT
"test5-%d{" DATE_PATTERN "}"));
rfa->setFile(LOG4CXX_STR("" DIR_PRE_OUTPUT "test5.log"));
- tbrp->activateOptions(pool);
+ tbrp->activateOptions();
rfa->setRollingPolicy(tbrp);
- rfa->activateOptions(pool);
+ rfa->activateOptions();
logger->addAppender(rfa);
+ Pool pool;
this->delGenericLogFile(pool, rfa->getFile());
this->buildTsFnames<4>(pool, LOG4CXX_STR("test5-"), fnames);
fnames[0].assign(rfa->getFile());
@@ -584,7 +584,6 @@ public:
*/
void test6()
{
- Pool pool;
const int nrOfFnames(4);
const int nrOfLogMsgs((nrOfFnames * 2) - 1);
LogString fnames[nrOfFnames];
@@ -597,11 +596,12 @@ public:
TimeBasedRollingPolicyPtr tbrp = TimeBasedRollingPolicyPtr(new
TimeBasedRollingPolicy());
tbrp->setFileNamePattern(LogString(LOG4CXX_STR(""
DIR_PRE_OUTPUT "test6-%d{" DATE_PATTERN "}.gz")));
rfa->setFile(LOG4CXX_STR("" DIR_PRE_OUTPUT "test6.log"));
- tbrp->activateOptions(pool);
+ tbrp->activateOptions();
rfa->setRollingPolicy(tbrp);
- rfa->activateOptions(pool);
+ rfa->activateOptions();
logger->addAppender(rfa);
+ Pool pool;
this->delGenericLogFile(pool, rfa->getFile());
this->buildTsFnames<4>(pool, LOG4CXX_STR("test6-"), fnames,
true);
fnames[0].assign(rfa->getFile());
@@ -644,7 +644,6 @@ public:
void rollIntoDir()
{
- Pool pool;
const int nrOfFnames(4);
const int nrOfLogMsgs((nrOfFnames * 2) - 1);
LogString fnames[nrOfFnames];
@@ -668,13 +667,14 @@ public:
TimeBasedRollingPolicyPtr tbrp(new TimeBasedRollingPolicy());
tbrp->setFileNamePattern(filenamePattern);
- tbrp->activateOptions(pool);
+ tbrp->activateOptions();
rfa->setRollingPolicy(tbrp);
- rfa->activateOptions(pool);
+ rfa->activateOptions();
logger->addAppender(rfa);
const logchar* prefix =
directoryName.append(LOG4CXX_STR("/file-")).data();
+ Pool pool;
this->delGenericLogFile(pool, rfa->getFile());
this->buildTsFnames<4>(pool, prefix, fnames);
fnames[0].assign(rfa->getFile());
diff --git a/src/test/cpp/throughput/log4cxxbenchmarker.cpp
b/src/test/cpp/throughput/log4cxxbenchmarker.cpp
index 42fedbfb..3c17f0cc 100644
--- a/src/test/cpp/throughput/log4cxxbenchmarker.cpp
+++ b/src/test/cpp/throughput/log4cxxbenchmarker.cpp
@@ -51,11 +51,6 @@ class NullWriterAppender : public log4cxx::AppenderSkeleton
// This gets called whenever there is a valid event for
our appender.
}
- void activateOptions(log4cxx::helpers::Pool& /* pool */)
override
- {
- // Given all of our options, do something useful(e.g.
open a file)
- }
-
void setOption(const LogString& option, const LogString& value)
override
{
}
diff --git a/src/test/cpp/varia/errorhandlertestcase.cpp
b/src/test/cpp/varia/errorhandlertestcase.cpp
index 5a479258..fa1ad06d 100644
--- a/src/test/cpp/varia/errorhandlertestcase.cpp
+++ b/src/test/cpp/varia/errorhandlertestcase.cpp
@@ -94,8 +94,7 @@ public:
LOGUNIT_ASSERT(eh != 0);
primary->setOption(LOG4CXX_STR("FILE"), BadPath);
- Pool p;
- primary->activateOptions(p);
+ primary->activateOptions();
LOGUNIT_ASSERT(eh->errorReported());
common();
@@ -140,8 +139,7 @@ public:
eh->setLogger(logger);
primary->setOption(LOG4CXX_STR("FILE"), BadPath);
- Pool p;
- primary->activateOptions(p);
+ primary->activateOptions();
LOGUNIT_ASSERT(eh->errorReported());
common();
diff --git a/src/test/cpp/xml/xmllayouttest.cpp
b/src/test/cpp/xml/xmllayouttest.cpp
index e8f185b8..326fe940 100644
--- a/src/test/cpp/xml/xmllayouttest.cpp
+++ b/src/test/cpp/xml/xmllayouttest.cpp
@@ -361,9 +361,8 @@ public:
*/
void testActivateOptions()
{
- Pool p;
XMLLayout layout;
- layout.activateOptions(p);
+ layout.activateOptions();
}
/**