From f2e1c50081e66b7962c707de90378ac9209070bc Mon Sep 17 00:00:00 2001
From: Tom Rondeau <trondeau@vt.edu>
Date: Wed, 13 Mar 2013 15:36:26 -0400
Subject: log: replacing log4cxx with log4cpp.

---
 docs/doxygen/other/extra_pages.dox |  2 +-
 docs/doxygen/other/logger.dox      | 22 ++++++++++++----------
 2 files changed, 13 insertions(+), 11 deletions(-)

(limited to 'docs/doxygen')

diff --git a/docs/doxygen/other/extra_pages.dox b/docs/doxygen/other/extra_pages.dox
index 44cdf9d483..94c741864d 100644
--- a/docs/doxygen/other/extra_pages.dox
+++ b/docs/doxygen/other/extra_pages.dox
@@ -80,7 +80,7 @@ audio-osx and audio-windows to be either satisfied or built.
 \li comedilib   (>= 0.8)     http://www.comedi.org/
 
 \subsection dep_gr_log gr-log: Logging Tools (Optional)
-\li log4cxx     (>= 0.10.0)  http://logging.apache.org/log4cxx
+\li log4cpp     (>= 1.0)  http://log4cpp.sourceforge.net/
 
 
 \section build_gr_cmake Building GNU Radio
diff --git a/docs/doxygen/other/logger.dox b/docs/doxygen/other/logger.dox
index f98a64657b..e0f8ac4965 100644
--- a/docs/doxygen/other/logger.dox
+++ b/docs/doxygen/other/logger.dox
@@ -4,20 +4,23 @@
 
 GNU Radio has a logging interface to enable various levels of logging
 information to be printed to the console or a file. The logger derives
-from log4cxx (http://logging.apache.org/log4cxx) which is readily
+from log4cpp (http://log4cpp.sourceforge.net/) which is readily
 available in most Linux distributions. This is an optional dependency
 and GNU Radio will work without it.
 
 When configuring GNU Radio, the -DENABLE_GR_LOG=On|Off option to cmake
 will allow the user to toggle use of the logger on and off. The logger
-defaults to "on" and will use log4cxx if it is available. If log4cxx
+defaults to "on" and will use log4cpp if it is available. If log4cpp
 is not found, the default logging will output to standard output or
 standard error, depending on the level of the log message.
 
 Logging is useful for blocks to print out certain amounts of data at
 different levels. These levels are:
 
-    TRACE < DEBUG < INFO < WARN < ERROR < FATAL
+<pre>
+    DEBUG < INFO < WARN < TRACE < ERROR < ALERT < CRIT < FATAL <EMERG
+</pre>
+
 
 The order here determines the level of output. These levels are
 hierarchical in that specifying any level also includes any level
@@ -123,7 +126,7 @@ simple examples of using them:
 
 If the logger is not enabled, then these macros become nops and do
 nothing (and d_logger and d_debug_logger are NULL pointers). If
-logging is enabled but the log4cxx library is not found, then TRACE,
+logging is enabled but the log4cpp library is not found, then TRACE,
 DEBUG, and INFO levels go to stdout and the rest to stderr.
 
 
@@ -133,11 +136,10 @@ If not using the simplified settings discussed above, where we can
 direct the logger messages to either a file or one of the standard
 outputs, we must use a more complicated configuration file. We do this
 by specifying the "log_config" option in the [LOG] section. The
-log4cxx documentation (found through
-http://logging.apache.org/log4cxx/) will provide more information on
-how configuration works and looks. Mostly, a default configuration
-script provided with GNU Radio can be used. After installation, the
-default configuration script is located at:
+log4cpp documentation will provide more information on how
+configuration works and looks. Mostly, a default configuration script
+provided with GNU Radio can be used. After installation, the default
+configuration script is located at:
 
 <pre>
     $prefix/etc/gnuradio/gr_log_default.xml
@@ -196,7 +198,7 @@ except we would use "gr_log_debug." in the GR_LOG_GETLOGGER call):
 \endcode
 
 This creates a pointer called LOG (which is instantiated as a
-log4cxx:LoggerPtr in the macro) that we can now use locally as the
+log4cpp:LoggerPtr in the macro) that we can now use locally as the
 input to our logging macros like 'GR_LOG_TRACE(LOG, "message")'.
 
 */
-- 
cgit v1.2.3


From 8b946999a7e332249236d7317a76fdd8d3387dc7 Mon Sep 17 00:00:00 2001
From: Tom Rondeau <trondeau@vt.edu>
Date: Wed, 13 Mar 2013 17:43:16 -0400
Subject: log: fixes to replace log4cxx with log4cpp.

---
 CMakeLists.txt                                |  3 --
 cmake/Modules/FindLog4cpp.cmake               | 23 ++++++--------
 cmake/Modules/GrMiscUtils.cmake               |  2 --
 docs/doxygen/other/logger.dox                 | 25 ++++++++-------
 gnuradio-core/CMakeLists.txt                  |  1 -
 gnuradio-core/gnuradio-core.conf.in           |  6 ++--
 gnuradio-core/src/lib/CMakeLists.txt          |  3 --
 gnuradio-core/src/lib/runtime/gr_logger.h     | 46 +++++++++++++--------------
 gnuradio-core/src/lib/runtime/qa_gr_logger.cc | 13 ++++----
 9 files changed, 54 insertions(+), 68 deletions(-)

(limited to 'docs/doxygen')

diff --git a/CMakeLists.txt b/CMakeLists.txt
index edfd269a2e..2c0a4e9096 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -231,10 +231,7 @@ endif(ENABLE_VOLK)
 
 # Handle gr_log enable/disable
 GR_LOGGING()
-set(LOG4CPP_LIBRARIES ${LOG4CPP_LIBRARY})
-message("First Libs: ${LOG4CPP_LIBRARIES}")
 
-message("First Lib: ${LOG4CPP_LIBRARY}")
 ########################################################################
 # Distribute the README file
 ########################################################################
diff --git a/cmake/Modules/FindLog4cpp.cmake b/cmake/Modules/FindLog4cpp.cmake
index 0b7208630f..fc314c61a5 100644
--- a/cmake/Modules/FindLog4cpp.cmake
+++ b/cmake/Modules/FindLog4cpp.cmake
@@ -23,19 +23,17 @@ find_library(LOG4CPP_LIBRARY
   PATHS /usr/lib /usr/local/lib /opt/local/lib
 )
 
-message("#####################")
-message("LOG INCLEUDE :${LOG4CPP_INCLUDE_DIR}")
-message("LOG LIBRARY :${LOG4CPP_LIBRARY}")
-
-
-message("#####################")
 
 if (LOG4CPP_INCLUDE_DIR AND LOG4CPP_LIBRARY)
   set(LOG4CPP_FOUND TRUE)
-  set(LOG4CPP_LIBRARIES ${LOG4CPP_LIBRARY} )
+  set(LOG4CPP_LIBRARIES ${LOG4CPP_LIBRARY} CACHE INTERNAL "" FORCE)
+  set(LOG4CPP_INCLUDE_DIRS ${LOG4CPP_INCLUDE_DIR} CACHE INTERNAL "" FORCE)
 else ()
-  set(LOG4CPP_FOUND FALSE)
-  set(LOG4CPP_LIBRARIES )
+  set(LOG4CPP_FOUND FALSE CACHE INTERNAL "" FORCE)
+  set(LOG4CPP_LIBRARY "" CACHE INTERNAL "" FORCE)
+  set(LOG4CPP_LIBRARIES "" CACHE INTERNAL "" FORCE)
+  set(LOG4CPP_INCLUDE_DIR "" CACHE INTERNAL "" FORCE)
+  set(LOG4CPP_INCLUDE_DIRS "" CACHE INTERNAL "" FORCE)
 endif ()
 
 if (LOG4CPP_FOUND)
@@ -49,10 +47,7 @@ else ()
   endif ()
 endif ()
 
-message("internal libs: ${LOG4CPP_LIBRARIES}")
-
 mark_as_advanced(
-  LOG4CPP_LIBRARY
   LOG4CPP_LIBRARIES
-  LOG4CPP_INCLUDE_DIR
-  )
+  LOG4CPP_INCLUDE_DIRS
+)
diff --git a/cmake/Modules/GrMiscUtils.cmake b/cmake/Modules/GrMiscUtils.cmake
index 65b0b5a8c8..69ff1f5ddc 100644
--- a/cmake/Modules/GrMiscUtils.cmake
+++ b/cmake/Modules/GrMiscUtils.cmake
@@ -220,8 +220,6 @@ endfunction(GR_GEN_TARGET_DEPS)
 function(GR_LOGGING)
   find_package(Log4cpp)
 
-  message(STATUS "LOG4CPP_LIBRARIES First set to ${LOG4CPP_LIBRARIES}.")
-
   OPTION(ENABLE_GR_LOG "Use gr_logger" ON)
   if(ENABLE_GR_LOG)
     # If gr_logger is enabled, make it usable
diff --git a/docs/doxygen/other/logger.dox b/docs/doxygen/other/logger.dox
index e0f8ac4965..9a97172ed0 100644
--- a/docs/doxygen/other/logger.dox
+++ b/docs/doxygen/other/logger.dox
@@ -18,7 +18,7 @@ Logging is useful for blocks to print out certain amounts of data at
 different levels. These levels are:
 
 <pre>
-    DEBUG < INFO < WARN < TRACE < ERROR < ALERT < CRIT < FATAL <EMERG
+    DEBUG < INFO < WARN < TRACE < ERROR < ALERT < CRIT < FATAL < EMERG
 </pre>
 
 
@@ -45,14 +45,14 @@ stream or file.
 The four main configure options are:
 
 <pre>
-  log_level = all
-  debug_level = all
+  log_level = debug
+  debug_level = debug
   log_file = stdout
   debug_file = stderr
 </pre>
 
 This establishes the two loggers as having access to all levels of
-logging events (TRACE through FATAL). They are also configured not to
+logging events (DEBUG through EMERG). They are also configured not to
 use files but instead output to the console. The standard logger will
 output to standard out while the debug logger outputs to standard
 error.
@@ -114,20 +114,21 @@ The various logging macros are defined in gr_logger.h. Here are some
 simple examples of using them:
 
 \code
-  GR_LOG_TRACE(LOG, "TRACE message");
   GR_LOG_DEBUG(LOG, "DEBUG message");
   GR_LOG_INFO(LOG, "INFO message");
+  GR_LOG_NOTICE(LOG, "NOTICE message");
   GR_LOG_WARN(LOG, "WARNING message");
   GR_LOG_ERROR(LOG, "ERROR message");
-  GR_FATAL(LOG, "FATAL message");
-  GR_ERRORIF(LOG, a>b, "CONDITIONAL ERROR message");
-  GR_ASSERT(LOG, a>b, "ASSERT error message");
+  GR_LOG_CRIT(LOG, "CRIT message");
+  GR_LOG_ALERT(LOG, "ALERT message");
+  GR_LOG_FATAL(LOG, "FATAL message");
+  GR_LOG_EMERG(LOG, "EMERG message");
 \endcode
 
 If the logger is not enabled, then these macros become nops and do
 nothing (and d_logger and d_debug_logger are NULL pointers). If
 logging is enabled but the log4cpp library is not found, then TRACE,
-DEBUG, and INFO levels go to stdout and the rest to stderr.
+INFO, and NOTICE levels go to stdout and the rest to stderr.
 
 
 \subsection adv_config Advanced Configuration Options
@@ -151,7 +152,7 @@ For the following examples, we will assume that our local
 \code
 [LOG]
 log_config = /opt/gr/etc/gnuadio/gr_log_default.xml
-log_level = All
+log_level = debug
 debug_level = Off
 \endcode
 
@@ -165,7 +166,7 @@ specified in the XML file. Here, we have turned on the standard logger
 (d_debug_logger). So even if the debug logger is used in the code, it
 will not actually output any information. Conversely, any level of
 output passed to the standard logger will output because we have
-turned this value to "all."
+turned this value to the lowest level "debug."
 
 If both an XML configuration file is set and the "log_file" or
 "debug_file" options are set at the same time, both systems are
@@ -199,6 +200,6 @@ except we would use "gr_log_debug." in the GR_LOG_GETLOGGER call):
 
 This creates a pointer called LOG (which is instantiated as a
 log4cpp:LoggerPtr in the macro) that we can now use locally as the
-input to our logging macros like 'GR_LOG_TRACE(LOG, "message")'.
+input to our logging macros like 'GR_LOG_INFO(LOG, "message")'.
 
 */
diff --git a/gnuradio-core/CMakeLists.txt b/gnuradio-core/CMakeLists.txt
index 97ca11e0a9..97e94cbc16 100644
--- a/gnuradio-core/CMakeLists.txt
+++ b/gnuradio-core/CMakeLists.txt
@@ -63,7 +63,6 @@ GR_SET_GLOBAL(GNURADIO_CORE_INCLUDE_DIRS
 )
 
 list(APPEND GNURADIO_CORE_INCLUDE_DIRS ${CMAKE_BINARY_DIR})
-message("GNURADIO_CORE_INCLUDE_DIRS ARE: ${GNURADIO_CORE_INCLUDE_DIRS}")
 
 GR_SET_GLOBAL(GNURADIO_CORE_SWIG_INCLUDE_DIRS
     ${GNURADIO_CORE_INCLUDE_DIRS}
diff --git a/gnuradio-core/gnuradio-core.conf.in b/gnuradio-core/gnuradio-core.conf.in
index 4de97e1ea5..25abedb253 100644
--- a/gnuradio-core/gnuradio-core.conf.in
+++ b/gnuradio-core/gnuradio-core.conf.in
@@ -12,9 +12,9 @@ max_messages = 100
 
 [LOG]
 # Levels can be (case insensitive):
-#   trace, debug, info, warn, error, fatal
-log_level = all
-debug_level = all
+#       DEBUG, INFO, WARN, TRACE, ERROR, ALERT, CRIT, FATAL, EMERG
+log_level = debug
+debug_level = emerg
 
 # These file names can either be 'stdout' to output to standard output
 # or 'stderr' to output to standard error. Any other string will
diff --git a/gnuradio-core/src/lib/CMakeLists.txt b/gnuradio-core/src/lib/CMakeLists.txt
index b69b858ad0..da6de8ed1b 100644
--- a/gnuradio-core/src/lib/CMakeLists.txt
+++ b/gnuradio-core/src/lib/CMakeLists.txt
@@ -82,9 +82,6 @@ link_directories(${LOG4CPP_LIBRARY_DIRS})
 #if(LOG4CPP_FOUND)
 #    add_definitions(-DENABLE_GR_LOG)
 #endif(LOG4CPP_FOUND)
-message("******************************************")
-message("LOG4CPP LIBRARIES are ${LOG4CPP_LIBRARIES}")
-message("******************************************")
 
 list(APPEND gnuradio_core_libs
     gruel
diff --git a/gnuradio-core/src/lib/runtime/gr_logger.h b/gnuradio-core/src/lib/runtime/gr_logger.h
index 2aadc3c936..13f31d60b8 100644
--- a/gnuradio-core/src/lib/runtime/gr_logger.h
+++ b/gnuradio-core/src/lib/runtime/gr_logger.h
@@ -70,35 +70,35 @@ typedef std::string gr_logger_ptr;
 #define GR_GET_LEVEL(name, level)
 #define GR_LOG_GET_LEVEL(logger, level)
 #define GR_ADD_CONSOLE_APPENDER(logger,target,pattern)
-#define GR_LOG_ADD_CONSOLE_APPENDER(logger,,target,pattern)
+#define GR_LOG_ADD_CONSOLE_APPENDER(logger,target,pattern)
 #define GR_ADD_FILE_APPENDER(name,filename,append,pattern)
 #define GR_LOG_ADD_FILE_APPENDER(logger,filename,append,pattern)
 #define GR_ADD_ROLLINGFILE_APPENDER(name,filename,filesize,bkup_index,append,mode,pattern)
 #define GR_LOG_ADD_ROLLINGFILE_APPENDER(logger,filename,filesize,bkup_index,append,mode,pattern)
 #define GR_GET_LOGGER_NAMES(names)
 #define GR_RESET_CONFIGURATION()
-#define GR_DEBUG(name, msg) std::cout<<"DEBUG:"<<msg<<std::endl
-#define GR_INFO(name, msg) std::cout<<"INFO:"<<msg<<std::endl
-#define GR_NOTICE(name, msg) std::cout<<"NOTICE:"<<msg<<std::endl
-#define GR_WARN(name, msg) std::cerr<<"WARN:"<<msg<<std::endl
-#define GR_ERROR(name, msg) std::cerr<<"ERROR:"<<msg<<std::endl
-#define GR_ALERT(name, msg) std::cerr<<"ERROR:"<<msg<<std::endl
-#define GR_CRIT(name, msg) std::cerr<<"ERROR:"<<msg<<std::endl
-#define GR_FATAL(name, msg) std::cerr<<"FATAL:"<<msg<<std::endl
-#define GR_EMERG(name, msg) std::cerr<<"EMERG:"<<msg<<std::endl
-#define GR_ERRORIF(name, cond, msg) if((cond)) std::cerr<<"ERROR:"<<msg<<std::endl
-#define GR_ASSERT(name, cond, msg) if(!(cond)) std::cerr<<"ERROR:"<<msg<<std::endl; assert(cond)
-#define GR_LOG_DEBUG(logger, msg) std::cout<<"DEBUG:"<<msg<<std::endl
-#define GR_LOG_INFO(logger, msg) std::cout<<"INFO:"<<msg<<std::endl
-#define GR_LOG_NOTICE(logger, msg) std::cout<<"NOTICE:"<<msg<<std::endl
-#define GR_LOG_WARN(logger, msg) std::cerr<<"WARN:"<<msg<<std::endl
-#define GR_LOG_ERROR(logger, msg) std::cerr<<"ERROR:"<<msg<<std::endl
-#define GR_LOG_ALERT(logger, msg) std::cerr<<"ALERT:"<<msg<<std::endl
-#define GR_LOG_CRIT(logger, msg) std::cerr<<"CRIT:"<<msg<<std::endl
-#define GR_LOG_FATAL(logger, msg) std::cerr<<"FATAL:"<<msg<<std::endl
-#define GR_LOG_EMERG(logger, msg) std::cerr<<"EMERG:"<<msg<<std::endl
-#define GR_LOG_ERRORIF(logger, cond, msg) if((cond)) std::cerr<<"ERROR:"<<msg<<std::endl
-#define GR_LOG_ASSERT(logger, cond, msg) std::cerr<<"ERROR:"<<msg<<std::endl; assert(cond)
+#define GR_DEBUG(name, msg) std::cout<<"DEBUG: "<<msg<<std::endl
+#define GR_INFO(name, msg) std::cout<<"INFO: "<<msg<<std::endl
+#define GR_NOTICE(name, msg) std::cout<<"NOTICE: "<<msg<<std::endl
+#define GR_WARN(name, msg) std::cerr<<"WARN: "<<msg<<std::endl
+#define GR_ERROR(name, msg) std::cerr<<"ERROR: "<<msg<<std::endl
+#define GR_ALERT(name, msg) std::cerr<<"ERROR: "<<msg<<std::endl
+#define GR_CRIT(name, msg) std::cerr<<"ERROR: "<<msg<<std::endl
+#define GR_FATAL(name, msg) std::cerr<<"FATAL: "<<msg<<std::endl
+#define GR_EMERG(name, msg) std::cerr<<"EMERG: "<<msg<<std::endl
+#define GR_ERRORIF(name, cond, msg) if((cond)) std::cerr<<"ERROR: "<<msg<<std::endl
+#define GR_ASSERT(name, cond, msg) if(!(cond)) std::cerr<<"ERROR: "<<msg<<std::endl; assert(cond)
+#define GR_LOG_DEBUG(logger, msg) std::cout<<"DEBUG: "<<msg<<std::endl
+#define GR_LOG_INFO(logger, msg) std::cout<<"INFO: "<<msg<<std::endl
+#define GR_LOG_NOTICE(logger, msg) std::cout<<"NOTICE: "<<msg<<std::endl
+#define GR_LOG_WARN(logger, msg) std::cerr<<"WARN: "<<msg<<std::endl
+#define GR_LOG_ERROR(logger, msg) std::cerr<<"ERROR: "<<msg<<std::endl
+#define GR_LOG_ALERT(logger, msg) std::cerr<<"ALERT: "<<msg<<std::endl
+#define GR_LOG_CRIT(logger, msg) std::cerr<<"CRIT: "<<msg<<std::endl
+#define GR_LOG_FATAL(logger, msg) std::cerr<<"FATAL: "<<msg<<std::endl
+#define GR_LOG_EMERG(logger, msg) std::cerr<<"EMERG: "<<msg<<std::endl
+#define GR_LOG_ERRORIF(logger, cond, msg) if((cond)) std::cerr<<"ERROR: "<<msg<<std::endl
+#define GR_LOG_ASSERT(logger, cond, msg) std::cerr<<"ERROR: "<<msg<<std::endl; assert(cond)
 
 #else /* HAVE_LOG4CPP */
 // Second configuration...logging to log4cpp
diff --git a/gnuradio-core/src/lib/runtime/qa_gr_logger.cc b/gnuradio-core/src/lib/runtime/qa_gr_logger.cc
index e409c6aea7..a8e4a1d766 100644
--- a/gnuradio-core/src/lib/runtime/qa_gr_logger.cc
+++ b/gnuradio-core/src/lib/runtime/qa_gr_logger.cc
@@ -41,13 +41,12 @@ qa_gr_logger::t1()
 
   GR_LOG_GETLOGGER(LOG,"main");
   GR_ADD_CONSOLE_APPENDER("main","cout","%d{%H:%M:%S} : %m%n");
-  GR_LOG_NOTICE(LOG,"test from c++ 1");
-  GR_LOG_DEBUG(LOG,"test from c++ 1");
-  GR_LOG_INFO(LOG,"test from c++ 1");
-  GR_LOG_WARN(LOG,"test from c++ 1");
-  GR_LOG_ERROR(LOG,"test from c++ 1");
-  GR_LOG_FATAL(LOG,"test from c++ 1");
-  GR_LOG_ERRORIF(LOG,2>1,"test from c++ 1");
+  GR_LOG_NOTICE(LOG,"test from c++ NOTICE");
+  GR_LOG_DEBUG(LOG,"test from c++ DEBUG");
+  GR_LOG_INFO(LOG,"test from c++ INFO");
+  GR_LOG_WARN(LOG,"test from c++ WARN");
+  GR_LOG_ERROR(LOG,"test from c++ ERROR");
+  GR_LOG_FATAL(LOG,"test from c++ FATAL");
   CPPUNIT_ASSERT(true);
 #endif
 }
-- 
cgit v1.2.3