This is an automated email from the ASF dual-hosted git repository. penghui pushed a commit to branch branch-2.7 in repository https://gitbox.apache.org/repos/asf/pulsar.git
commit b272df4e64a8f648c52837f66cbc3bda414ed135 Author: Andreas Neustifter <[email protected]> AuthorDate: Fri May 21 14:48:18 2021 +0200 [Issue 10161] Fix missing LoggerFactoryPtr type. (#10164) Fixes #10161. ### Motivation With issue #7132 the LoggerFactoryPtr was removed in favour of relevant memory-safe(r) pointers. This change forgot to also change the Log4Cxx implementation, fix this by returning (as with the other LoggerFactory's) a std::unique_ptr<LoggerFactory>. (cherry picked from commit d700f8d742f3a4be8330b773e27f59bbc528926f) --- pulsar-client-cpp/lib/Log4CxxLogger.h | 5 +++-- pulsar-client-cpp/lib/Log4cxxLogger.cc | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/pulsar-client-cpp/lib/Log4CxxLogger.h b/pulsar-client-cpp/lib/Log4CxxLogger.h index e3c0b56..cd2fe9e 100644 --- a/pulsar-client-cpp/lib/Log4CxxLogger.h +++ b/pulsar-client-cpp/lib/Log4CxxLogger.h @@ -28,11 +28,12 @@ namespace pulsar { class PULSAR_PUBLIC Log4CxxLoggerFactory : public LoggerFactory { public: - static LoggerFactoryPtr create(); - static LoggerFactoryPtr create(const std::string& log4cxxConfFile); + static std::unique_ptr<LoggerFactory> create(); + static std::unique_ptr<LoggerFactory> create(const std::string& log4cxxConfFile); Logger* getLogger(const std::string& fileName); }; + } // namespace pulsar #endif diff --git a/pulsar-client-cpp/lib/Log4cxxLogger.cc b/pulsar-client-cpp/lib/Log4cxxLogger.cc index 5b1a2ab..f28da1a 100644 --- a/pulsar-client-cpp/lib/Log4cxxLogger.cc +++ b/pulsar-client-cpp/lib/Log4cxxLogger.cc @@ -62,7 +62,7 @@ class Log4CxxLogger : public Logger { } }; -LoggerFactoryPtr Log4CxxLoggerFactory::create() { +std::unique_ptr<LoggerFactory> Log4CxxLoggerFactory::create() { if (!LogManager::getLoggerRepository()->isConfigured()) { LogManager::getLoggerRepository()->setConfigured(true); LoggerPtr root = log4cxx::Logger::getRootLogger(); @@ -73,10 +73,10 @@ LoggerFactoryPtr Log4CxxLoggerFactory::create() { root->addAppender(appender); } - return LoggerFactoryPtr(new Log4CxxLoggerFactory()); + return std::unique_ptr<LoggerFactory>(new Log4CxxLoggerFactory()); } -LoggerFactoryPtr Log4CxxLoggerFactory::create(const std::string &log4cxxConfFile) { +std::unique_ptr<LoggerFactory> Log4CxxLoggerFactory::create(const std::string &log4cxxConfFile) { try { log4cxx::PropertyConfigurator::configure(log4cxxConfFile); } catch (const std::exception &e) { @@ -87,7 +87,7 @@ LoggerFactoryPtr Log4CxxLoggerFactory::create(const std::string &log4cxxConfFile << std::endl; } - return LoggerFactoryPtr(new Log4CxxLoggerFactory()); + return std::unique_ptr<LoggerFactory>(new Log4CxxLoggerFactory()); } Logger *Log4CxxLoggerFactory::getLogger(const std::string &fileName) { return new Log4CxxLogger(fileName); }
