Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sebastian Schrader
Kea
Commits
5da8f813
Commit
5da8f813
authored
Jun 03, 2013
by
JINMEI Tatuya
Browse files
[master] Merge branch 'trac1622'
parents
156c5f32
71007940
Changes
4
Hide whitespace changes
Inline
Side-by-side
doc/guide/bind10-guide.xml
View file @
5da8f813
...
...
@@ -5567,6 +5567,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>
...
...
src/lib/log/logger_manager_impl.cc
View file @
5da8f813
...
...
@@ -35,7 +35,10 @@
#include
<log/logger_specification.h>
#include
<log/buffer_appender_impl.h>
#include
<boost/lexical_cast.hpp>
using
namespace
std
;
using
boost
::
lexical_cast
;
namespace
isc
{
namespace
log
{
...
...
@@ -121,21 +124,33 @@ 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
)
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
)
{
fileapp
=
log4cplus
::
SharedAppenderPtr
(
new
log4cplus
::
FileAppender
(
opt
.
filename
,
mode
,
opt
.
flush
));
}
else
{
log4cplus
::
helpers
::
Properties
properties
;
properties
.
setProperty
(
"File"
,
opt
.
filename
);
properties
.
setProperty
(
"MaxFileSize"
,
lexical_cast
<
string
>
(
opt
.
maxsize
));
properties
.
setProperty
(
"MaxBackupIndex"
,
lexical_cast
<
string
>
(
opt
.
maxver
));
properties
.
setProperty
(
"ImmediateFlush"
,
opt
.
flush
?
"true"
:
"false"
);
properties
.
setProperty
(
"UseLockFile"
,
"true"
);
fileapp
=
log4cplus
::
SharedAppenderPtr
(
new
log4cplus
::
RollingFileAppender
(
opt
.
filename
,
opt
.
maxsize
,
opt
.
maxver
,
opt
.
flush
));
new
log4cplus
::
RollingFileAppender
(
properties
));
}
// use the same console layout for the files.
...
...
src/lib/log/tests/Makefile.am
View file @
5da8f813
...
...
@@ -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
...
...
src/lib/log/tests/logger_manager_unittest.cc
View file @
5da8f813
...
...
@@ -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
()));
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment