BIND 10 trac1622, updated. 71007940646f888480f85dc2780c0d600f64d179 [1622] remove log4cplus lock file used in unit tests more explicitly
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed May 29 23:39:37 UTC 2013
The branch, trac1622 has been updated
via 71007940646f888480f85dc2780c0d600f64d179 (commit)
via 439ab563402b77e745db3181af1751ebcac519f3 (commit)
via c1ca91c677addbb7a546ea8e36cc67e0717f1fb7 (commit)
via cab5acfd0cd42260988424e06d926d22e37e1e11 (commit)
from d4389a32b03dafe3c369e9d10d0001687ec74f55 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 71007940646f888480f85dc2780c0d600f64d179
Author: JINMEI Tatuya <jinmei at isc.org>
Date: Wed May 29 16:30:15 2013 -0700
[1622] remove log4cplus lock file used in unit tests more explicitly
commit 439ab563402b77e745db3181af1751ebcac519f3
Author: JINMEI Tatuya <jinmei at isc.org>
Date: Wed May 29 16:20:35 2013 -0700
[1622] added a note about the log roll over issue
commit c1ca91c677addbb7a546ea8e36cc67e0717f1fb7
Author: JINMEI Tatuya <jinmei at isc.org>
Date: Wed May 29 15:57:27 2013 -0700
[1622] some cleanups
commit cab5acfd0cd42260988424e06d926d22e37e1e11
Author: JINMEI Tatuya <jinmei at isc.org>
Date: Wed May 29 15:40:46 2013 -0700
[1622] make sure log4cplus's internal lock file is cleaned up
necessary for distcheck to work correctly.
-----------------------------------------------------------------------
Summary of changes:
doc/guide/bind10-guide.xml | 17 +++++++++++++++++
src/lib/log/logger_manager_impl.cc | 9 +++++++--
src/lib/log/tests/Makefile.am | 2 +-
src/lib/log/tests/logger_manager_unittest.cc | 6 +++++-
4 files changed, 30 insertions(+), 4 deletions(-)
-----------------------------------------------------------------------
diff --git a/doc/guide/bind10-guide.xml b/doc/guide/bind10-guide.xml
index 568bbea..990f84c 100644
--- a/doc/guide/bind10-guide.xml
+++ b/doc/guide/bind10-guide.xml
@@ -5506,6 +5506,23 @@ TODO; there's a ticket to determine these levels, see #1074
If this is 0, no maximum file size is used.
</para>
+ <note>
+ <simpara>
+ Due to a limitation of the underlying logging library
+ (log4cplus), rolling over the log files (from ".1" to
+ ".2", etc) may show odd results: There can be
+ multiple small files at the timing of roll over. This
+ can happen when multiple BIND 10 processes try to roll
+ over the files simultaneously.
+ Version 1.1.0 of log4cplus solved this problem, so if
+ this or higher version of log4cplus is used to build
+ BIND 10, it shouldn't happen. Even for older versions
+ it is normally expected to happen rarely unless the log
+ messages are produced very frequently by multiple
+ different processes.
+ </simpara>
+ </note>
+
</section>
<section>
diff --git a/src/lib/log/logger_manager_impl.cc b/src/lib/log/logger_manager_impl.cc
index f6f5bf1..9fb4d57 100644
--- a/src/lib/log/logger_manager_impl.cc
+++ b/src/lib/log/logger_manager_impl.cc
@@ -124,12 +124,17 @@ LoggerManagerImpl::createConsoleAppender(log4cplus::Logger& logger,
// File appender. Depending on whether a maximum size is given, either
// a standard file appender or a rolling file appender will be created.
+// In the case of the latter, we set "UseLockFile" to true so that
+// log4cplus internally avoids race in rolling over the files by multiple
+// processes. This feature isn't supported in log4cplus 1.0.x, but setting
+// the property unconditionally is okay as unknown properties are simply
+// ignored.
void
LoggerManagerImpl::createFileAppender(log4cplus::Logger& logger,
const OutputOption& opt)
{
// Append to existing file
- std::ios::openmode mode = std::ios::app;
+ const std::ios::openmode mode = std::ios::app;
log4cplus::SharedAppenderPtr fileapp;
if (opt.maxsize == 0) {
@@ -142,7 +147,7 @@ LoggerManagerImpl::createFileAppender(log4cplus::Logger& logger,
lexical_cast<string>(opt.maxsize));
properties.setProperty("MaxBackupIndex",
lexical_cast<string>(opt.maxver));
- properties.setProperty("ImmediateFlush", "true");
+ properties.setProperty("ImmediateFlush", opt.flush ? "true" : "false");
properties.setProperty("UseLockFile", "true");
fileapp = log4cplus::SharedAppenderPtr(
new log4cplus::RollingFileAppender(properties));
diff --git a/src/lib/log/tests/Makefile.am b/src/lib/log/tests/Makefile.am
index 36582e6..92303e0 100644
--- a/src/lib/log/tests/Makefile.am
+++ b/src/lib/log/tests/Makefile.am
@@ -10,7 +10,7 @@ if USE_STATIC_LINK
AM_LDFLAGS += -static
endif
-CLEANFILES = *.gcno *.gcda
+CLEANFILES = *.gcno *.gcda *.lock
EXTRA_DIST = log_test_messages.mes
BUILT_SOURCES = log_test_messages.h log_test_messages.cc
diff --git a/src/lib/log/tests/logger_manager_unittest.cc b/src/lib/log/tests/logger_manager_unittest.cc
index 584d0f5..e615c41 100644
--- a/src/lib/log/tests/logger_manager_unittest.cc
+++ b/src/lib/log/tests/logger_manager_unittest.cc
@@ -77,7 +77,11 @@ public:
// Destructor, remove the file. This is only a test, so ignore failures
~SpecificationForFileLogger() {
if (! name_.empty()) {
- (void) unlink(name_.c_str());
+ static_cast<void>(unlink(name_.c_str()));
+
+ // Depending on the log4cplus version, a lock file may also be
+ // created.
+ static_cast<void>(unlink((name_ + ".lock").c_str()));
}
}
More information about the bind10-changes
mailing list