Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
Kea
Commits
6731bd9e
Commit
6731bd9e
authored
Oct 19, 2016
by
Francis Dupont
Browse files
[master] Merged trac4636 (log4cplus 2.x support)
parent
232a2b9f
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/lib/log/buffer_appender_impl.cc
View file @
6731bd9e
// Copyright (C) 2012-201
5
Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2012-201
6
Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
...
...
@@ -7,6 +7,7 @@
#include <log/buffer_appender_impl.h>
#include <log4cplus/loglevel.h>
#include <log4cplus/version.h>
#include <boost/scoped_ptr.hpp>
#include <cstdio>
...
...
@@ -75,8 +76,12 @@ BufferAppender::append(const log4cplus::spi::InternalLoggingEvent& event) {
"Internal log buffer has been flushed already"
);
}
// get a clone, and put the pointer in a shared_ptr in the list
std
::
auto_ptr
<
log4cplus
::
spi
::
InternalLoggingEvent
>
event_aptr
=
event
.
clone
();
#if LOG4CPLUS_VERSION < LOG4CPLUS_MAKE_VERSION(2, 0, 0)
std
::
auto_ptr
<
log4cplus
::
spi
::
InternalLoggingEvent
>
#else
std
::
unique_ptr
<
log4cplus
::
spi
::
InternalLoggingEvent
>
#endif
event_aptr
=
event
.
clone
();
// Also store the string representation of the log level, to be
// used in flushStdout if necessary
stored_
.
push_back
(
LevelAndEvent
(
...
...
src/lib/log/logger_manager_impl.cc
View file @
6731bd9e
// Copyright (C) 2011-201
5
Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2011-201
6
Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
...
...
@@ -16,6 +16,7 @@
#include <log4cplus/fileappender.h>
#include <log4cplus/syslogappender.h>
#include <log4cplus/helpers/loglog.h>
#include <log4cplus/version.h>
#include <log/logger.h>
#include <log/logger_support.h>
...
...
@@ -239,8 +240,13 @@ void LoggerManagerImpl::setConsoleAppenderLayout(
string
pattern
=
"%D{%Y-%m-%d %H:%M:%S.%q} %-5p [%c/%i] %m
\n
"
;
// Finally the text of the message
auto_ptr
<
log4cplus
::
Layout
>
layout
(
new
log4cplus
::
PatternLayout
(
pattern
));
appender
->
setLayout
(
layout
);
appender
->
setLayout
(
#if LOG4CPLUS_VERSION < LOG4CPLUS_MAKE_VERSION(2, 0, 0)
auto_ptr
<
log4cplus
::
Layout
>
#else
unique_ptr
<
log4cplus
::
Layout
>
#endif
(
new
log4cplus
::
PatternLayout
(
pattern
)));
}
// Set the the "syslog" layout for the given appenders. This is the same
...
...
@@ -254,8 +260,13 @@ void LoggerManagerImpl::setSyslogAppenderLayout(
string
pattern
=
"%-5p [%c] %m
\n
"
;
// Finally the text of the message
auto_ptr
<
log4cplus
::
Layout
>
layout
(
new
log4cplus
::
PatternLayout
(
pattern
));
appender
->
setLayout
(
layout
);
appender
->
setLayout
(
#if LOG4CPLUS_VERSION < LOG4CPLUS_MAKE_VERSION(2, 0, 0)
auto_ptr
<
log4cplus
::
Layout
>
#else
unique_ptr
<
log4cplus
::
Layout
>
#endif
(
new
log4cplus
::
PatternLayout
(
pattern
)));
}
void
LoggerManagerImpl
::
storeBufferAppenders
()
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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