From: Francis Dupont Date: Wed, 19 Oct 2016 13:25:13 +0000 (+0200) Subject: [master] Merged trac4636 (log4cplus 2.x support) X-Git-Tag: trac5014_base X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6731bd9e264e32d75ec9e57c67fe587ce5a62800;p=thirdparty%2Fkea.git [master] Merged trac4636 (log4cplus 2.x support) --- diff --git a/src/lib/log/buffer_appender_impl.cc b/src/lib/log/buffer_appender_impl.cc index 6d6e8a09bf..6c287cdbe5 100644 --- a/src/lib/log/buffer_appender_impl.cc +++ b/src/lib/log/buffer_appender_impl.cc @@ -1,4 +1,4 @@ -// 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 #include +#include #include #include @@ -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 event_aptr = - event.clone(); +#if LOG4CPLUS_VERSION < LOG4CPLUS_MAKE_VERSION(2, 0, 0) + std::auto_ptr +#else + std::unique_ptr +#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( diff --git a/src/lib/log/logger_manager_impl.cc b/src/lib/log/logger_manager_impl.cc index 065db9e313..a5cf1781e3 100644 --- a/src/lib/log/logger_manager_impl.cc +++ b/src/lib/log/logger_manager_impl.cc @@ -1,4 +1,4 @@ -// 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 #include #include +#include #include #include @@ -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 layout(new log4cplus::PatternLayout(pattern)); - appender->setLayout(layout); + appender->setLayout( +#if LOG4CPLUS_VERSION < LOG4CPLUS_MAKE_VERSION(2, 0, 0) + auto_ptr +#else + unique_ptr +#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 layout(new log4cplus::PatternLayout(pattern)); - appender->setLayout(layout); + appender->setLayout( +#if LOG4CPLUS_VERSION < LOG4CPLUS_MAKE_VERSION(2, 0, 0) + auto_ptr +#else + unique_ptr +#endif + (new log4cplus::PatternLayout(pattern))); } void LoggerManagerImpl::storeBufferAppenders() {