]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#1273] Reverted to raw LoggerImpl pointer
authorFrancis Dupont <fdupont@isc.org>
Tue, 16 Jun 2020 18:56:36 +0000 (20:56 +0200)
committerFrancis Dupont <fdupont@isc.org>
Tue, 16 Jun 2020 18:56:36 +0000 (20:56 +0200)
src/lib/log/logger.cc
src/lib/log/logger.h
src/lib/log/logger_impl.cc
src/lib/log/logger_impl.h

index 4c2316d6eef0b196fab0616f4baa76e30ff7859a..d0cd19609fb201459d9941ef1e89f603f7b6d4fc 100644 (file)
@@ -16,8 +16,6 @@
 #include <log/message_dictionary.h>
 #include <log/message_types.h>
 
-#include <boost/make_shared.hpp>
-
 #include <util/strutil.h>
 
 using namespace std;
@@ -25,7 +23,7 @@ using namespace std;
 namespace isc {
 namespace log {
 
-LoggerImplPtr
+LoggerImpl*
 Logger::getLoggerPtr() {
     if (!initialized_) {
         lock_guard<mutex> lk(mutex_);
@@ -41,7 +39,7 @@ Logger::getLoggerPtr() {
 void
 Logger::initLoggerImpl() {
     if (isLoggingInitialized()) {
-        loggerptr_ = boost::make_shared<LoggerImpl>(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
index a14a3c3d7b5caaffc70797ad40a569623116bfe1..36fc141792aafee1a7a666e97038d592f04f3cba 100644 (file)
@@ -14,7 +14,6 @@
 #include <string>
 
 #include <exceptions/exceptions.h>
-#include <log/logger_impl.h>
 #include <log/logger_level.h>
 #include <log/message_types.h>
 #include <log/log_formatter.h>
@@ -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];
index 7b94a25be7252877d629b591f4577631942d155a..853cba056de0811b4d170d12c8f47843f551b9af 100644 (file)
@@ -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
index 7f96aa95a154d6bc0fb45122a31a01be53460b64..b41bbcb16f524d77ef116a51363f44afcc5e2fee 100644 (file)
@@ -19,7 +19,6 @@
 #include <boost/shared_ptr.hpp>
 #include <boost/noncopyable.hpp>
 
-
 // log4cplus logger header file
 #include <log4cplus/logger.h>
 
@@ -194,9 +193,6 @@ private:
     isc::log::interprocess::InterprocessSync* sync_;
 };
 
-/// \brief Pointer to the Logger implementation.
-typedef boost::shared_ptr<LoggerImpl> LoggerImplPtr;
-
 } // namespace log
 } // namespace isc