You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by sw...@apache.org on 2024/03/07 06:44:04 UTC
(logging-log4cxx) 03/03: Benchmark async checks should use AsyncAppender
This is an automated email from the ASF dual-hosted git repository.
swebb2066 pushed a commit to branch benchmark_fix_3
in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git
commit cb54d491fe9bb7c59f4182101556376e9db5966d
Author: Stephen Webb <sw...@gmail.com>
AuthorDate: Thu Mar 7 17:43:40 2024 +1100
Benchmark async checks should use AsyncAppender
---
src/test/cpp/benchmark/benchmark.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/test/cpp/benchmark/benchmark.cpp b/src/test/cpp/benchmark/benchmark.cpp
index 49df7fe1..2bc04b7a 100644
--- a/src/test/cpp/benchmark/benchmark.cpp
+++ b/src/test/cpp/benchmark/benchmark.cpp
@@ -143,7 +143,7 @@ public: // Class methods
writer->setLayout(std::make_shared<PatternLayout>(LOG4CXX_STR("%m%n")));
auto asyncAppender = std::make_shared<AsyncAppender>();
asyncAppender->addAppender(writer);
- asyncAppender->setBlocking(true);
+ asyncAppender->setBlocking(false);
result = r->getLogger(name);
result->setAdditivity(false);
result->setLevel(Level::getInfo());
@@ -286,7 +286,7 @@ BENCHMARK_DEFINE_F(benchmarker, asyncIntPlusFloatValueMessageBuffer)(benchmark::
for (auto _ : state)
{
auto f = static_cast<float>(rand()) / static_cast<float>(RAND_MAX);
- LOG4CXX_INFO( m_logger, "Hello: message number " << ++x
+ LOG4CXX_INFO( m_asyncLogger, "Hello: message number " << ++x
<< " pseudo-random float " << std::setprecision(3) << std::fixed << f);
}
}