You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by si...@apache.org on 2019/07/19 07:14:15 UTC
[pulsar] branch master updated: Fix C++ log level names in
Log4cxxLogger (#4735)
This is an automated email from the ASF dual-hosted git repository.
sijie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new af8ea71 Fix C++ log level names in Log4cxxLogger (#4735)
af8ea71 is described below
commit af8ea71a0d87d6db4432353cb250e87f77d8ebb9
Author: massakam <ma...@yahoo-corp.jp>
AuthorDate: Fri Jul 19 16:14:09 2019 +0900
Fix C++ log level names in Log4cxxLogger (#4735)
### Motivation
If trying to build master C++ code with the `USE_LOG4CXX` flag turned ON, compilation errors occur:
```
/tmp/pulsar/pulsar-client-cpp/lib/Log4cxxLogger.cc: In static member function ‘static log4cxx::LevelPtr pulsar::Log4CxxLogger::getLevel(pulsar::Logger::Level)’:
/tmp/pulsar/pulsar-client-cpp/lib/Log4cxxLogger.cc:53:18: error: ‘DEBUG’ was not declared in this scope
case DEBUG:
^
/tmp/pulsar/pulsar-client-cpp/lib/Log4cxxLogger.cc:55:18: error: ‘INFO’ was not declared in this scope
case INFO:
^
/tmp/pulsar/pulsar-client-cpp/lib/Log4cxxLogger.cc:57:18: error: ‘WARN’ was not declared in this scope
case WARN:
^
/tmp/pulsar/pulsar-client-cpp/lib/Log4cxxLogger.cc:59:18: error: ‘ERROR’ was not declared in this scope
case ERROR:
^
/tmp/pulsar/pulsar-client-cpp/lib/Log4cxxLogger.cc:52:16: error: enumeration value ‘LEVEL_DEBUG’ not handled in switch [-Werror=switch]
switch (level) {
^
/tmp/pulsar/pulsar-client-cpp/lib/Log4cxxLogger.cc:52:16: error: enumeration value ‘LEVEL_INFO’ not handled in switch [-Werror=switch]
/tmp/pulsar/pulsar-client-cpp/lib/Log4cxxLogger.cc:52:16: error: enumeration value ‘LEVEL_WARN’ not handled in switch [-Werror=switch]
/tmp/pulsar/pulsar-client-cpp/lib/Log4cxxLogger.cc:52:16: error: enumeration value ‘LEVEL_ERROR’ not handled in switch [-Werror=switch]
cc1plus: some warnings being treated as errors
make[2]: *** [lib/CMakeFiles/pulsarStatic.dir/Log4cxxLogger.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
```
This is because the enum values renamed in https://github.com/apache/pulsar/pull/4664 are still used in `Log4cxxLogger.cc`.
### Modifications
Fixed the enum values used in `Log4cxxLogger.cc` by adding the prefix `LEVEL_`.
---
pulsar-client-cpp/lib/Log4cxxLogger.cc | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/pulsar-client-cpp/lib/Log4cxxLogger.cc b/pulsar-client-cpp/lib/Log4cxxLogger.cc
index 99cc614..5b1a2ab 100644
--- a/pulsar-client-cpp/lib/Log4cxxLogger.cc
+++ b/pulsar-client-cpp/lib/Log4cxxLogger.cc
@@ -50,13 +50,13 @@ class Log4CxxLogger : public Logger {
private:
static log4cxx::LevelPtr getLevel(Level level) {
switch (level) {
- case DEBUG:
+ case LEVEL_DEBUG:
return log4cxx::Level::getDebug();
- case INFO:
+ case LEVEL_INFO:
return log4cxx::Level::getInfo();
- case WARN:
+ case LEVEL_WARN:
return log4cxx::Level::getWarn();
- case ERROR:
+ case LEVEL_ERROR:
return log4cxx::Level::getError();
}
}