From: Mukund Sivaraman Date: Wed, 1 Aug 2012 03:16:58 +0000 (+0530) Subject: [2169] Fix tree for changes in log4cplus 1.1.0 X-Git-Tag: trac2351_base~97^2~7^2~3^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3378f9b44d6d8a5cceedd9b9f6177d77985a01bf;p=thirdparty%2Fkea.git [2169] Fix tree for changes in log4cplus 1.1.0 This is based on a patch sent in by John Lumby. Code still compiles and works with log4cplus 1.0.4. --- diff --git a/src/lib/log/logger_impl.cc b/src/lib/log/logger_impl.cc index 2d6c0f4a27..6cd3da532e 100644 --- a/src/lib/log/logger_impl.cc +++ b/src/lib/log/logger_impl.cc @@ -22,6 +22,7 @@ #include #include +#include #include #include diff --git a/src/lib/log/logger_level_impl.cc b/src/lib/log/logger_level_impl.cc index 397f6d4b76..bfc4748198 100644 --- a/src/lib/log/logger_level_impl.cc +++ b/src/lib/log/logger_level_impl.cc @@ -185,20 +185,22 @@ LoggerLevelImpl::logLevelFromString(const log4cplus::tstring& level) { // Convert logging level to string. If the level is a valid debug level, // return the string DEBUG, else return the empty string. -log4cplus::tstring +LoggerLevelImpl::LogLevelString LoggerLevelImpl::logLevelToString(log4cplus::LogLevel level) { + static const tstring debug_string("DEBUG"); + static const tstring empty_string; Level bindlevel = convertToBindLevel(level); Severity& severity = bindlevel.severity; int& dbglevel = bindlevel.dbglevel; if ((severity == DEBUG) && ((dbglevel >= MIN_DEBUG_LEVEL) && (dbglevel <= MAX_DEBUG_LEVEL))) { - return (tstring("DEBUG")); + return (debug_string); } // Unknown, so return empty string for log4cplus to try other conversion // functions. - return (tstring()); + return (empty_string); } // Initialization. Register the conversion functions with the LogLevelManager. diff --git a/src/lib/log/logger_level_impl.h b/src/lib/log/logger_level_impl.h index c9907966a4..17b866d6df 100644 --- a/src/lib/log/logger_level_impl.h +++ b/src/lib/log/logger_level_impl.h @@ -16,6 +16,7 @@ #define __LOGGER_LEVEL_IMPL_H #include +#include #include namespace isc { @@ -65,6 +66,12 @@ namespace log { class LoggerLevelImpl { public: +#if (LOG4CPLUS_VERSION >= LOG4CPLUS_MAKE_VERSION(1, 1, 0)) + typedef log4cplus::tstring const & LogLevelString; +#else + typedef log4cplus::tstring LogLevelString; +#endif + /// \brief Convert BIND 10 level to log4cplus logging level /// /// Converts the BIND 10 severity level into a log4cplus logging level. @@ -112,7 +119,7 @@ public: /// \param level Extended logging level /// /// \return Equivalent string. - static log4cplus::tstring logLevelToString(log4cplus::LogLevel level); + static LogLevelString logLevelToString(log4cplus::LogLevel level); /// \brief Initialize extended logging levels /// diff --git a/src/lib/log/logger_manager_impl.cc b/src/lib/log/logger_manager_impl.cc index 68f2bb8b4f..1af40c1bc4 100644 --- a/src/lib/log/logger_manager_impl.cc +++ b/src/lib/log/logger_manager_impl.cc @@ -17,6 +17,7 @@ #include #include +#include #include #include #include