Commit 6731bd9e authored by Francis Dupont's avatar Francis Dupont

[master] Merged trac4636 (log4cplus 2.x support)

parent 232a2b9f
// Copyright (C) 2012-2015 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2012-2016 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(
......
// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2011-2016 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() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment