From: Francis Dupont Date: Tue, 16 Jun 2020 18:56:36 +0000 (+0200) Subject: [#1273] Reverted to raw LoggerImpl pointer X-Git-Tag: Kea-1.7.9~42 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d5651bb82c2ff078ae5138869fc99d205b6f2597;p=thirdparty%2Fkea.git [#1273] Reverted to raw LoggerImpl pointer --- diff --git a/src/lib/log/logger.cc b/src/lib/log/logger.cc index 4c2316d6ee..d0cd19609f 100644 --- a/src/lib/log/logger.cc +++ b/src/lib/log/logger.cc @@ -16,8 +16,6 @@ #include #include -#include - #include using namespace std; @@ -25,7 +23,7 @@ using namespace std; namespace isc { namespace log { -LoggerImplPtr +LoggerImpl* Logger::getLoggerPtr() { if (!initialized_) { lock_guard lk(mutex_); @@ -41,7 +39,7 @@ Logger::getLoggerPtr() { void Logger::initLoggerImpl() { if (isLoggingInitialized()) { - loggerptr_ = boost::make_shared(name_); + loggerptr_ = new LoggerImpl(name_); } else { isc_throw(LoggingNotInitialized, "attempt to access logging function " "before logging has been initialized"); @@ -51,6 +49,12 @@ Logger::initLoggerImpl() { // Destructor. Logger::~Logger() { + delete loggerptr_; + + // The next statement is required for the Kea hooks framework, where a + // statically-linked Kea loads and unloads multiple libraries. See the hooks + // documentation for more details. + loggerptr_ = 0; } // Get Version diff --git a/src/lib/log/logger.h b/src/lib/log/logger.h index a14a3c3d7b..36fc141792 100644 --- a/src/lib/log/logger.h +++ b/src/lib/log/logger.h @@ -14,7 +14,6 @@ #include #include -#include #include #include #include @@ -161,7 +160,7 @@ public: /// \note Note also that there is no constructor taking a std::string. This /// minimizes the possibility of initializing a static logger with a /// string, so leading to problems mentioned above. - Logger(const char* name) : loggerptr_(), initialized_(false) { + Logger(const char* name) : loggerptr_(0), initialized_(false) { // Validate the name of the logger. if (name) { @@ -337,13 +336,13 @@ private: /// cause a "LoggingNotInitialized" exception to be thrown. /// /// \return Returns pointer to implementation - LoggerImplPtr getLoggerPtr(); + LoggerImpl* getLoggerPtr(); /// \brief Initialize Underlying Implementation and Set loggerptr_ void initLoggerImpl(); ///< Pointer to underlying logger - LoggerImplPtr loggerptr_; + LoggerImpl* loggerptr_; ///< Copy of the logger name char name_[MAX_LOGGER_NAME_SIZE + 1]; diff --git a/src/lib/log/logger_impl.cc b/src/lib/log/logger_impl.cc index 7b94a25be7..853cba056d 100644 --- a/src/lib/log/logger_impl.cc +++ b/src/lib/log/logger_impl.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2011-2019 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2011-2020 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 diff --git a/src/lib/log/logger_impl.h b/src/lib/log/logger_impl.h index 7f96aa95a1..b41bbcb16f 100644 --- a/src/lib/log/logger_impl.h +++ b/src/lib/log/logger_impl.h @@ -19,7 +19,6 @@ #include #include - // log4cplus logger header file #include @@ -194,9 +193,6 @@ private: isc::log::interprocess::InterprocessSync* sync_; }; -/// \brief Pointer to the Logger implementation. -typedef boost::shared_ptr LoggerImplPtr; - } // namespace log } // namespace isc