From f078026e1ac4037e6ec9212c6e8085ef683ab5bc Mon Sep 17 00:00:00 2001
From: Tom Rondeau <trondeau@vt.edu>
Date: Thu, 7 Jun 2012 12:40:29 -0400
Subject: docs: adding info on gr-log feature.

---
 docs/doxygen/other/build_guide.dox |  2 +
 docs/doxygen/other/main_page.dox   | 85 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 87 insertions(+)

(limited to 'docs/doxygen')

diff --git a/docs/doxygen/other/build_guide.dox b/docs/doxygen/other/build_guide.dox
index 780976d626..fe4b44f345 100644
--- a/docs/doxygen/other/build_guide.dox
+++ b/docs/doxygen/other/build_guide.dox
@@ -69,6 +69,8 @@ about building gr-comedi.
 \subsection dep_gr_comedi gr-comedi: Comedi hardware interface
 \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
 
 
 \section build_gr_cmake Building GNU Radio
diff --git a/docs/doxygen/other/main_page.dox b/docs/doxygen/other/main_page.dox
index 68b0989436..08873aa3d4 100644
--- a/docs/doxygen/other/main_page.dox
+++ b/docs/doxygen/other/main_page.dox
@@ -48,4 +48,89 @@ Many blocks have already been converted to use Volk in their calls, so
 they can also serve as examples. See the gr_complex_to_xxx.h file for
 examples of various blocks that make use of Volk.
 
+
+\section logging Logging
+
+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
+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 option to cmake will
+allow the user to toggle use of the logger on and off and will turn
+off if log4cxx is not available.
+
+Logging is useful for blocks to print out certain amounts of data at
+different levels. These levels are:
+
+    TRACE < DEBUG < INFO < WARN < ERROR < FATAL
+
+The order here determines the level of output. When using the Debug
+level, for instance, all Debug and higher messages are logged and
+Trace is ignored.
+
+\subsection use_logging Using the Logging Features
+
+In a GNU Radio block, you use the logging features by calling macros
+that are defined in gr_log.h, which must be included for use.
+
+The logger must be properly configured, which is easiest by defining a
+configuration file. The log4cxx website 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:
+
+    $prefix/share/gnuradio/gr_log_default.xml
+
+In a class, we must first configure the logger and then get access to it:
+
+\code
+  GR_CONFIG_LOGGER("prefix/share/gnuradio/gr_log_default.xml");
+  GR_LOG_GETLOGGER(LOG, name);
+\endcode
+
+The default config file has two names that can be used (as std::string
+types): "gr_log" and "gr_log_debug". The first one will print
+all levels of logging informaiton while the second one will only print
+Debug and above.
+
+The "LOG" name for the logger is now a LoggerPtr object and can be
+named anything.
+
+For a given block, it is recommended that a new name be specified for
+individual control over the logger as loggers are globally held in a
+LoggerManager. Since log4cxx is hierarchical, a new name is created by
+appending a string to an existing logger. So a general logger used in
+the digital_costas_loop_cc.cc class, for instance, could look
+something like "gr_log.costas_loop". This will inherit all properties
+of the parent logger, "gr_log".
+
+After calling "GR_LOG_GETLOGGER", the LoggerPtr that was specified,
+"LOG" in the example above, is used to set the properties. For
+instance, the level for any logger can be easily modified using the
+setLogger(level) method, such as:
+
+\code
+  LOG->setLevel(log4cxx::Level::getAll());
+\endcode
+
+In this case, the "getAll()" method sets the logger's level to log
+everything. Other methods are "getDebug()", "getInfo()", and so on for
+the different levels of logging.
+
+The various logging macros are defined in gr_log.h. Here are some
+simple exmaples of using them:
+
+\code
+  GR_LOG_TRACE(LOG, "TRACE message");
+  GR_LOG_DEBUG(LOG, "DEBUG message");
+  GR_LOG_INFO(LOG, "INFO 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");
+\endcode
+
 */
-- 
cgit v1.2.3


From d71d02d7eb01b56b842d6a71a2b7d087c5513e7b Mon Sep 17 00:00:00 2001
From: Tom Rondeau <trondeau@vt.edu>
Date: Fri, 8 Jun 2012 12:15:42 -0400
Subject: Fixing up the gr-log capabilities.

Better handling of enable/disable function, easier integration with all components if log4cxx is or is not there. All components have been updated to be able to use logging. Docs update, too.
---
 CMakeLists.txt                             |  3 ++
 cmake/Modules/FindLog4cxx.cmake            |  2 +-
 cmake/Modules/GrMiscUtils.cmake            | 32 +++++++++++++++++++
 docs/doxygen/other/main_page.dox           |  6 ++--
 gnuradio-core/CMakeLists.txt               |  6 ----
 gnuradio-core/src/lib/CMakeLists.txt       | 15 +++++----
 gnuradio-core/src/lib/runtime/gr_log.h     | 49 +++++++++++++++---------------
 gnuradio-core/src/lib/runtime/gr_log.i     |  4 +--
 gnuradio-core/src/lib/runtime/qa_gr_log.cc |  2 +-
 gnuradio-core/src/lib/swig/CMakeLists.txt  | 23 ++++++++------
 gnuradio-core/src/tests/CMakeLists.txt     |  7 ++---
 gr-atsc/src/lib/CMakeLists.txt             |  4 +++
 gr-audio/lib/CMakeLists.txt                |  5 ++-
 gr-comedi/src/CMakeLists.txt               |  4 +++
 gr-digital/lib/CMakeLists.txt              | 12 +++-----
 gr-fcd/lib/CMakeLists.txt                  |  5 ++-
 gr-noaa/lib/CMakeLists.txt                 |  4 +++
 gr-pager/lib/CMakeLists.txt                |  4 +++
 gr-qtgui/lib/CMakeLists.txt                |  4 +++
 gr-shd/lib/CMakeLists.txt                  |  4 +++
 gr-trellis/src/lib/CMakeLists.txt          |  4 +++
 gr-uhd/lib/CMakeLists.txt                  |  4 +++
 gr-video-sdl/src/CMakeLists.txt            |  4 +++
 gr-vocoder/lib/CMakeLists.txt              |  4 +++
 gr-wavelet/lib/CMakeLists.txt              |  4 +++
 25 files changed, 145 insertions(+), 70 deletions(-)

(limited to 'docs/doxygen')

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 73473c5f3a..ccfb0e4386 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -210,6 +210,9 @@ endif(ENABLE_VOLK)
 
 GR_VMCIRCBUF()
 
+# Handle gr_log enable/disable
+GR_LOGGING()
+
 ########################################################################
 # Distribute the README file
 ########################################################################
diff --git a/cmake/Modules/FindLog4cxx.cmake b/cmake/Modules/FindLog4cxx.cmake
index c1cc6571ef..b1e4f6f1f7 100644
--- a/cmake/Modules/FindLog4cxx.cmake
+++ b/cmake/Modules/FindLog4cxx.cmake
@@ -1,7 +1,7 @@
 #   CMake module to find LOG4CXX library
 
 INCLUDE(FindPkgConfig)
-PKG_CHECK_MODULES(PC_LOG4CXX log4cxx)
+PKG_CHECK_MODULES(PC_LOG4CXX liblog4cxx)
 
 FIND_PATH(
     LOG4CXX_INCLUDE_DIRS
diff --git a/cmake/Modules/GrMiscUtils.cmake b/cmake/Modules/GrMiscUtils.cmake
index 189e97c7e2..6b708bf730 100644
--- a/cmake/Modules/GrMiscUtils.cmake
+++ b/cmake/Modules/GrMiscUtils.cmake
@@ -233,3 +233,35 @@ function(GR_VMCIRCBUF)
     add_definitions( -DTRY_SHM_VMCIRCBUF )
   endif(TRY_SHM_VMCIRCBUF)
 endfunction(GR_VMCIRCBUF)
+
+
+########################################################################
+# Control use of gr_log
+# Usage:
+#   GR_LOGGING()
+#
+# Will set ENABLE_GR_LOG to 1 by default.
+# Can manually set with -DENABLE_GR_LOG=0|1
+########################################################################
+function(GR_LOGGING)
+  find_package(Log4cxx)
+
+  OPTION(ENABLE_GR_LOG "Use gr_log" ON)
+  
+  if(NOT LOG4CXX_FOUND)
+    SET(ENABLE_GR_LOG OFF)
+  endif(NOT LOG4CXX_FOUND)
+
+  message(STATUS "ENABLE_GR_LOG set to ${ENABLE_GR_LOG}.")
+
+  if(ENABLE_GR_LOG)
+    add_definitions( -DENABLE_GR_LOG )
+  else(ENABLE_GR_LOG)
+    # If not enabled or available, set these variable to
+    # blank so we can use them later without having to
+    # check ENABLE_GR_LOG each time.
+    SET(LOG4CXX_INCLUDE_DIRS "" CACHE INTERNAL "" FORCE)
+    SET(LOG4CXX_LIBRARY_DIRS "" CACHE INTERNAL "" FORCE)
+    SET(LOG4CXX_LIBRARIES "" CACHE INTERNAL "" FORCE)
+  endif(ENABLE_GR_LOG)
+endfunction(GR_LOGGING)
diff --git a/docs/doxygen/other/main_page.dox b/docs/doxygen/other/main_page.dox
index 08873aa3d4..8f47ed0d74 100644
--- a/docs/doxygen/other/main_page.dox
+++ b/docs/doxygen/other/main_page.dox
@@ -57,9 +57,9 @@ from log4cxx (http://logging.apache.org/log4cxx) 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 option to cmake will
-allow the user to toggle use of the logger on and off and will turn
-off if log4cxx is not available.
+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 and will
+turn off if log4cxx is not available.
 
 Logging is useful for blocks to print out certain amounts of data at
 different levels. These levels are:
diff --git a/gnuradio-core/CMakeLists.txt b/gnuradio-core/CMakeLists.txt
index 63badbddbf..0227108446 100644
--- a/gnuradio-core/CMakeLists.txt
+++ b/gnuradio-core/CMakeLists.txt
@@ -23,7 +23,6 @@
 include(GrBoost)
 
 find_package(FFTW3f)
-find_package(Log4cxx)
 
 include(GrPython) #used for code generation
 
@@ -44,11 +43,6 @@ GR_REGISTER_COMPONENT("gnuradio-core" ENABLE_GR_CORE
     PYTHONINTERP_FOUND
 )
 
-# Making a new component so people can easily turn the log featue on/off
-GR_REGISTER_COMPONENT("gr-log" ENABLE_GR_LOG
-    LOG4CXX_FOUND
-)
-
 include(GrMiscUtils)
 GR_SET_GLOBAL(GNURADIO_CORE_INCLUDE_DIRS
     ${GRUEL_INCLUDE_DIRS} #headers depend on gruel
diff --git a/gnuradio-core/src/lib/CMakeLists.txt b/gnuradio-core/src/lib/CMakeLists.txt
index 4412558628..30cd5897bb 100644
--- a/gnuradio-core/src/lib/CMakeLists.txt
+++ b/gnuradio-core/src/lib/CMakeLists.txt
@@ -50,26 +50,25 @@ link_directories(${Boost_LIBRARY_DIRS})
 include_directories(${FFTW3F_INCLUDE_DIRS})
 link_directories(${FFTW3F_LIBRARY_DIRS})
 
+include_directories(${LOG4CXX_INCLUDE_DIRS})
+link_directories(${LOG4CXX_LIBRARY_DIRS})
 
 ########################################################################
 # Setup library
 ########################################################################
 
 # Only use if log4cxx is installed
-# Define DISABLE_GR_LOG so .h and .cc files can turn actual
+# Define ENABLE_GR_LOG so .h and .cc files can turn actual
 # logging and insert dummy functions.
-if(LOG4CXX_FOUND)
-    include_directories(${LOG4CXX_INCLUDE_DIRS})
-    link_directories(${LOG4CXX_LIBRARIES})
-    list(APPEND gnuradio_core_libs ${LOG4CXX_LIBRARIES} )
-else(LOG4CXX_FOUND)
-    add_definitions(-DDISABLE_GR_LOG)
-endif(LOG4CXX_FOUND)
+#if(LOG4CXX_FOUND)
+#    add_definitions(-DENABLE_GR_LOG)
+#endif(LOG4CXX_FOUND)
 
 list(APPEND gnuradio_core_libs
     gruel
     ${Boost_LIBRARIES}
     ${FFTW3F_LIBRARIES}
+    ${LOG4CXX_LIBRARIES}
 )
 
 if(FFTW3F_THREADS_LIBRARIES)
diff --git a/gnuradio-core/src/lib/runtime/gr_log.h b/gnuradio-core/src/lib/runtime/gr_log.h
index 1a52d2aef6..4f718567df 100644
--- a/gnuradio-core/src/lib/runtime/gr_log.h
+++ b/gnuradio-core/src/lib/runtime/gr_log.h
@@ -37,29 +37,7 @@
 *
 */
 
-//If DISABLE_GR_LOG set then clear all logging macros
-#ifdef DISABLE_GR_LOG
-
-#define GR_CONFIG_LOGGER(config)
-#define GR_LOG_GETLOGGER(logger, name) 
-#define GR_TRACE(name, msg)
-#define GR_DEBUG(name, msg)
-#define GR_INFO(name, msg)
-#define GR_WARN(name, msg) 
-#define GR_ERROR(name, msg) 
-#define GR_FATAL(name, msg) 
-#define GR_ERRORIF(name, cond, msg)
-#define GR_ASSERT(name, cond, msg)
-#define GR_LOG_TRACE(logger, msg)
-#define GR_LOG_DEBUG(logger, msg)
-#define GR_LOG_INFO(logger, msg) 
-#define GR_LOG_WARN(logger, msg) 
-#define GR_LOG_ERROR(logger, msg) 
-#define GR_LOG_FATAL(logger, msg) 
-#define GR_LOG_ERRORIF(logger, cond, msg)
-#define GR_LOG_ASSERT(logger, cond, msg)
-
-#else
+#ifdef ENABLE_GR_LOG
 
 #include <stdio.h>
 #include <string>
@@ -262,5 +240,28 @@ class gr_log
   void log_assert(LoggerPtr logger,bool cond,std::string msg){GR_LOG_ASSERT(logger,cond,msg);};
 };
 
-#endif /* DISABLE_GR_LOG */
+
+//If ENABLE_GR_LOG not set then clear all logging macros
+#else
+
+#define GR_CONFIG_LOGGER(config)
+#define GR_LOG_GETLOGGER(logger, name) 
+#define GR_TRACE(name, msg)
+#define GR_DEBUG(name, msg)
+#define GR_INFO(name, msg)
+#define GR_WARN(name, msg) 
+#define GR_ERROR(name, msg) 
+#define GR_FATAL(name, msg) 
+#define GR_ERRORIF(name, cond, msg)
+#define GR_ASSERT(name, cond, msg)
+#define GR_LOG_TRACE(logger, msg)
+#define GR_LOG_DEBUG(logger, msg)
+#define GR_LOG_INFO(logger, msg) 
+#define GR_LOG_WARN(logger, msg) 
+#define GR_LOG_ERROR(logger, msg) 
+#define GR_LOG_FATAL(logger, msg) 
+#define GR_LOG_ERRORIF(logger, cond, msg)
+#define GR_LOG_ASSERT(logger, cond, msg)
+
+#endif /* ENABLE_GR_LOG */
 #endif /* INCLUDED_GR_LOG_H */
diff --git a/gnuradio-core/src/lib/runtime/gr_log.i b/gnuradio-core/src/lib/runtime/gr_log.i
index d56edd4f37..e539c5528b 100644
--- a/gnuradio-core/src/lib/runtime/gr_log.i
+++ b/gnuradio-core/src/lib/runtime/gr_log.i
@@ -40,7 +40,7 @@
 //-----------------------------------
 
 
-#ifndef DISABLE_GR_LOG
+#ifdef ENABLE_GR_LOG
 
 %{
 // The .h files
@@ -82,4 +82,4 @@ public:
   void log_assert(LoggerPtr logger,bool cond,std::string msg);
 };
 
-#endif
+#endif /* ENABLE_GR_LOG */
diff --git a/gnuradio-core/src/lib/runtime/qa_gr_log.cc b/gnuradio-core/src/lib/runtime/qa_gr_log.cc
index d8d0914992..a973408028 100644
--- a/gnuradio-core/src/lib/runtime/qa_gr_log.cc
+++ b/gnuradio-core/src/lib/runtime/qa_gr_log.cc
@@ -35,7 +35,7 @@
 void
 qa_gr_log::t1()
 {
-#ifndef DISABLE_GR_LOG
+#ifdef ENABLE_GR_LOG
   // This doesn't really test anything, more just
   // making sure nothing's gone horribly wrong.
   GR_LOG_GETLOGGER(LOG,"errLoggerRoot");
diff --git a/gnuradio-core/src/lib/swig/CMakeLists.txt b/gnuradio-core/src/lib/swig/CMakeLists.txt
index 3bef440f66..f7af17b2d6 100644
--- a/gnuradio-core/src/lib/swig/CMakeLists.txt
+++ b/gnuradio-core/src/lib/swig/CMakeLists.txt
@@ -24,24 +24,28 @@ include(GrSwig)
 include_directories(${Boost_INCLUDE_DIRS})
 link_directories(${Boost_LIBRARY_DIRS})
 
+include_directories(${LOG4CXX_INCLUDE_DIRS})
+link_directories(${LOG4CXX_LIBRARY_DIRS})
+
 set(GR_SWIG_INCLUDE_DIRS
     ${Boost_INCLUDE_DIRS}
     ${GSL_INCLUDE_DIRS}
     ${GRUEL_INCLUDE_DIRS}
+    ${LOG4CXX_INCLUDE_DIRS}
     ${GNURADIO_CORE_SWIG_INCLUDE_DIRS}
     ${CMAKE_CURRENT_BINARY_DIR}
 )
-set(GR_SWIG_LIBRARIES gnuradio-core)
+set(GR_SWIG_LIBRARIES
+    gnuradio-core
+    ${LOG4CXX_LIBRARIES}
+)
 
 # Only use if log4cxx is installed
-# Define DISABLE_GR_LOG for the .i file to ignore it.
-if(LOG4CXX_FOUND)
-    link_directories(${LOG4CXX_LIBRARY_DIRS})
-    list(APPEND GR_SWIG_LIBRARIES log4cxx)
-    list(APPEND GR_SWIG_INCLUDE_DIRS ${LOG4CXX_INCLUDE_DIRS})
-else(LOG4CXX_FOUND)
-    add_definitions(-DDISABLE_GR_LOG)
-endif(LOG4CXX_FOUND)
+# Define ENABLE_GR_LOG for the .i file to ignore it.
+#if(ENABLE_GR_LOG)
+#    add_definitions(-DENABLE_GR_LOG)
+#    SET(GR_SWIG_FLAGS "-DENABLE_GR_LOG")
+#endif(ENABLE_GR_LOG)
 
 ########################################################################
 # Build and install the swig targets
@@ -56,7 +60,6 @@ endif(LOG4CXX_FOUND)
 set(GR_SWIG_TARGET_DEPS gengen_generated filter_generated)
 
 foreach(what runtime general gengen filter io hier)
-    SET(GR_SWIG_FLAGS "-DDISABLE_GR_LOG")
     SET(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/${what}_swig_doc.i)
     SET(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../${what} ${CMAKE_CURRENT_BINARY_DIR}/../${what})
     GR_SWIG_MAKE(gnuradio_core_${what} gnuradio_core_${what}.i)
diff --git a/gnuradio-core/src/tests/CMakeLists.txt b/gnuradio-core/src/tests/CMakeLists.txt
index 6a18dc38a9..616b192b6a 100644
--- a/gnuradio-core/src/tests/CMakeLists.txt
+++ b/gnuradio-core/src/tests/CMakeLists.txt
@@ -33,11 +33,8 @@ link_directories(${Boost_LIBRARY_DIRS})
 include_directories(${CPPUNIT_INCLUDE_DIRS})
 link_directories(${CPPUNIT_LIBRARY_DIRS})
 
-# Only use if log4cxx is installed
-if(LOG4CXX_FOUND)
-  include_directories(${LOG4CXX_INCLUDE_DIRS})
-  link_directories(${LOG4CXX_LIBRARY_DIRS})
-endif(LOG4CXX_FOUND)
+include_directories(${LOG4CXX_INCLUDE_DIRS})
+link_directories(${LOG4CXX_LIBRARY_DIRS})
 
 ########################################################################
 # Build benchmarks and non-registered tests
diff --git a/gr-atsc/src/lib/CMakeLists.txt b/gr-atsc/src/lib/CMakeLists.txt
index dc51f0c902..54fa26aa2e 100644
--- a/gr-atsc/src/lib/CMakeLists.txt
+++ b/gr-atsc/src/lib/CMakeLists.txt
@@ -29,6 +29,9 @@ include_directories(
 include_directories(${Boost_INCLUDE_DIRS})
 link_directories(${Boost_LIBRARY_DIRS})
 
+include_directories(${LOG4CXX_INCLUDE_DIRS})
+link_directories(${LOG4CXX_LIBRARY_DIRS})
+
 ########################################################################
 # Generate viterbi mux source
 # http://www.vtk.org/Wiki/CMake_Cross_Compiling#Using_executables_in_the_build_created_during_the_build
@@ -97,6 +100,7 @@ list(APPEND gr_atsc_sources
 list(APPEND atsc_libs
     gnuradio-core
     ${Boost_LIBRARIES}
+    ${LOG4CXX_LIBRARIES}
 )
 
 add_library(gnuradio-atsc SHARED ${gr_atsc_sources})
diff --git a/gr-audio/lib/CMakeLists.txt b/gr-audio/lib/CMakeLists.txt
index 7e0252a8b1..9172c13f21 100644
--- a/gr-audio/lib/CMakeLists.txt
+++ b/gr-audio/lib/CMakeLists.txt
@@ -29,7 +29,10 @@ include_directories(
 include_directories(${Boost_INCLUDE_DIRS})
 link_directories(${Boost_LIBRARY_DIRS})
 
-list(APPEND gr_audio_libs gnuradio-core ${Boost_LIBRARIES})
+include_directories(${LOG4CXX_INCLUDE_DIRS})
+link_directories(${LOG4CXX_LIBRARY_DIRS})
+
+list(APPEND gr_audio_libs gnuradio-core ${Boost_LIBRARIES} ${LOG4CXX_LIBRARIES})
 list(APPEND gr_audio_sources gr_audio_registry.cc)
 list(APPEND gr_audio_confs ${CMAKE_CURRENT_SOURCE_DIR}/gr-audio.conf)
 
diff --git a/gr-comedi/src/CMakeLists.txt b/gr-comedi/src/CMakeLists.txt
index 1d3d16908b..37b0b2b434 100644
--- a/gr-comedi/src/CMakeLists.txt
+++ b/gr-comedi/src/CMakeLists.txt
@@ -31,6 +31,9 @@ link_directories(${Boost_LIBRARY_DIRS})
 include_directories(${COMEDI_INCLUDE_DIRS})
 link_directories(${COMEDI_LIBRARY_DIRS})
 
+include_directories(${LOG4CXX_INCLUDE_DIRS})
+link_directories(${LOG4CXX_LIBRARY_DIRS})
+
 ########################################################################
 # Setup library
 ########################################################################
@@ -44,6 +47,7 @@ list(APPEND comedi_libs
     gnuradio-core
     ${Boost_LIBRARIES}
     ${COMEDI_LIBRARIES}
+    ${LOG4CXX_LIBRARIES}
 )
 
 add_library(gnuradio-comedi SHARED ${gr_comedi_sources})
diff --git a/gr-digital/lib/CMakeLists.txt b/gr-digital/lib/CMakeLists.txt
index 72b4377de5..64ae069fa0 100644
--- a/gr-digital/lib/CMakeLists.txt
+++ b/gr-digital/lib/CMakeLists.txt
@@ -28,18 +28,13 @@ include_directories(
 include_directories(${Boost_INCLUDE_DIRS})
 link_directories(${Boost_LIBRARY_DIRS})
 
+include_directories(${LOG4CXX_INCLUDE_DIRS})
+link_directories(${LOG4CXX_LIBRARY_DIRS})
+
 ########################################################################
 # Setup library
 ########################################################################
 
-if(ENABLE_GR_LOG)
-    include_directories(${LOG4CXX_INCLUDE_DIRS})
-    link_directories(${LOG4CXX_LIBRARIES})
-    list(APPEND digital_libs ${LOG4CXX_LIBRARIES} )
-else(ENABLE_GR_LOG)
-    add_definitions(-DDISABLE_GR_LOG)
-endif(ENABLE_GR_LOG)
-
 list(APPEND gr_digital_sources
     digital_impl_mpsk_snr_est.cc
     digital_binary_slicer_fb.cc
@@ -71,6 +66,7 @@ list(APPEND gr_digital_sources
 list(APPEND digital_libs
     gnuradio-core
     ${Boost_LIBRARIES}
+    ${LOG4CXX_LIBRARIES}
 )
 
 add_library(gnuradio-digital SHARED ${gr_digital_sources})
diff --git a/gr-fcd/lib/CMakeLists.txt b/gr-fcd/lib/CMakeLists.txt
index 9a5605d99c..e7ed6d8d79 100644
--- a/gr-fcd/lib/CMakeLists.txt
+++ b/gr-fcd/lib/CMakeLists.txt
@@ -35,6 +35,9 @@ include_directories(
 include_directories(${Boost_INCLUDE_DIRS})
 link_directories(${Boost_LIBRARY_DIRS})
 
+include_directories(${LOG4CXX_INCLUDE_DIRS})
+link_directories(${LOG4CXX_LIBRARY_DIRS})
+
 ########################################################################
 # Setup library
 ########################################################################
@@ -66,7 +69,7 @@ add_library(gnuradio-fcd SHARED ${gr_fcd_sources})
 if (LINUX)
   list(APPEND fcd_libs rt)
 endif()
-target_link_libraries(gnuradio-fcd ${fcd_libs})
+target_link_libraries(gnuradio-fcd ${fcd_libs} ${LOG4CXX_LIBRARIES})
 
 
 GR_LIBRARY_FOO(gnuradio-fcd RUNTIME_COMPONENT "fcd_runtime" DEVEL_COMPONENT "fcd_devel")
diff --git a/gr-noaa/lib/CMakeLists.txt b/gr-noaa/lib/CMakeLists.txt
index 7bac21e4a4..7a9b71d84f 100644
--- a/gr-noaa/lib/CMakeLists.txt
+++ b/gr-noaa/lib/CMakeLists.txt
@@ -28,6 +28,9 @@ include_directories(
 include_directories(${Boost_INCLUDE_DIRS})
 link_directories(${Boost_LIBRARY_DIRS})
 
+include_directories(${LOG4CXX_INCLUDE_DIRS})
+link_directories(${LOG4CXX_LIBRARY_DIRS})
+
 ########################################################################
 # Setup library
 ########################################################################
@@ -40,6 +43,7 @@ list(APPEND gr_noaa_sources
 list(APPEND noaa_libs
     gnuradio-core
     ${Boost_LIBRARIES}
+    ${LOG4CXX_LIBRARIES}
 )
 
 add_library(gnuradio-noaa SHARED ${gr_noaa_sources})
diff --git a/gr-pager/lib/CMakeLists.txt b/gr-pager/lib/CMakeLists.txt
index 7b91c5a33b..dfde704ee8 100644
--- a/gr-pager/lib/CMakeLists.txt
+++ b/gr-pager/lib/CMakeLists.txt
@@ -28,6 +28,9 @@ include_directories(
 include_directories(${Boost_INCLUDE_DIRS})
 link_directories(${Boost_LIBRARY_DIRS})
 
+include_directories(${LOG4CXX_INCLUDE_DIRS})
+link_directories(${LOG4CXX_LIBRARY_DIRS})
+
 ########################################################################
 # Setup library
 ########################################################################
@@ -45,6 +48,7 @@ list(APPEND gr_pager_sources
 list(APPEND pager_libs
     gnuradio-core
     ${Boost_LIBRARIES}
+    ${LOG4CXX_LIBRARIES}
 )
 
 add_library(gnuradio-pager SHARED ${gr_pager_sources})
diff --git a/gr-qtgui/lib/CMakeLists.txt b/gr-qtgui/lib/CMakeLists.txt
index 2dc35e81cb..6a8016df0f 100644
--- a/gr-qtgui/lib/CMakeLists.txt
+++ b/gr-qtgui/lib/CMakeLists.txt
@@ -69,6 +69,9 @@ include_directories(
 include_directories(${Boost_INCLUDE_DIRS})
 link_directories(${Boost_LIBRARY_DIRS})
 
+include_directories(${LOG4CXX_INCLUDE_DIRS})
+link_directories(${LOG4CXX_LIBRARY_DIRS})
+
 include_directories(${QWT_INCLUDE_DIRS})
 link_directories(${QWT_LIBRARY_DIRS})
 
@@ -83,6 +86,7 @@ list(APPEND qtgui_libs
     ${QT_LIBRARIES}
     ${QWT_LIBRARIES}
     ${PYTHON_LIBRARIES}
+    ${LOG4CXX_LIBRARIES}
 )
 
 add_definitions(-DQWT_DLL) #setup QWT library linkage
diff --git a/gr-shd/lib/CMakeLists.txt b/gr-shd/lib/CMakeLists.txt
index 9ddf109af0..41f6b60ae4 100644
--- a/gr-shd/lib/CMakeLists.txt
+++ b/gr-shd/lib/CMakeLists.txt
@@ -31,6 +31,9 @@ link_directories(${SHD_LIBRARY_DIRS})
 include_directories(${Boost_INCLUDE_DIRS})
 link_directories(${Boost_LIBRARY_DIRS})
 
+include_directories(${LOG4CXX_INCLUDE_DIRS})
+link_directories(${LOG4CXX_LIBRARY_DIRS})
+
 ########################################################################
 # Setup library
 ########################################################################
@@ -43,6 +46,7 @@ list(APPEND shd_libs
     gnuradio-core
     ${Boost_LIBRARIES}
     ${SHD_LIBRARIES}
+    ${LOG4CXX_LIBRARIES}
 )
 
 add_library(gnuradio-shd SHARED ${gr_shd_sources})
diff --git a/gr-trellis/src/lib/CMakeLists.txt b/gr-trellis/src/lib/CMakeLists.txt
index 9080afa56e..c3f753f859 100644
--- a/gr-trellis/src/lib/CMakeLists.txt
+++ b/gr-trellis/src/lib/CMakeLists.txt
@@ -31,6 +31,9 @@ include_directories(
 include_directories(${Boost_INCLUDE_DIRS})
 link_directories(${Boost_LIBRARY_DIRS})
 
+include_directories(${LOG4CXX_INCLUDE_DIRS})
+link_directories(${LOG4CXX_LIBRARY_DIRS})
+
 ########################################################################
 # generate the python helper script which calls into the build utils
 ########################################################################
@@ -149,6 +152,7 @@ list(APPEND gr_trellis_sources
 list(APPEND trellis_libs
     gnuradio-core
     ${Boost_LIBRARIES}
+    ${LOG4CXX_LIBRARIES}
 )
 
 add_library(gnuradio-trellis SHARED ${gr_trellis_sources})
diff --git a/gr-uhd/lib/CMakeLists.txt b/gr-uhd/lib/CMakeLists.txt
index 810d1446ac..703e4e9460 100644
--- a/gr-uhd/lib/CMakeLists.txt
+++ b/gr-uhd/lib/CMakeLists.txt
@@ -32,6 +32,9 @@ link_directories(${UHD_LIBRARY_DIRS})
 include_directories(${Boost_INCLUDE_DIRS})
 link_directories(${Boost_LIBRARY_DIRS})
 
+include_directories(${LOG4CXX_INCLUDE_DIRS})
+link_directories(${LOG4CXX_LIBRARY_DIRS})
+
 ########################################################################
 # Setup library
 ########################################################################
@@ -45,6 +48,7 @@ list(APPEND uhd_libs
     gnuradio-core
     ${Boost_LIBRARIES}
     ${UHD_LIBRARIES}
+    ${LOG4CXX_LIBRARIES}
 )
 
 add_library(gnuradio-uhd SHARED ${gr_uhd_sources})
diff --git a/gr-video-sdl/src/CMakeLists.txt b/gr-video-sdl/src/CMakeLists.txt
index c21c9a9c86..e3bfe29849 100644
--- a/gr-video-sdl/src/CMakeLists.txt
+++ b/gr-video-sdl/src/CMakeLists.txt
@@ -28,6 +28,9 @@ include_directories(
 include_directories(${Boost_INCLUDE_DIRS})
 link_directories(${Boost_LIBRARY_DIRS})
 
+include_directories(${LOG4CXX_INCLUDE_DIRS})
+link_directories(${LOG4CXX_LIBRARY_DIRS})
+
 include_directories(${SDL_INCLUDE_DIR})
 
 ########################################################################
@@ -42,6 +45,7 @@ list(APPEND video_sdl_libs
     gnuradio-core
     ${Boost_LIBRARIES}
     ${SDL_LIBRARY}
+    ${LOG4CXX_LIBRARIES}
 )
 
 add_library(gnuradio-video-sdl SHARED ${gr_video_sdl_sources})
diff --git a/gr-vocoder/lib/CMakeLists.txt b/gr-vocoder/lib/CMakeLists.txt
index 69219b03f5..67d06d4b29 100644
--- a/gr-vocoder/lib/CMakeLists.txt
+++ b/gr-vocoder/lib/CMakeLists.txt
@@ -28,6 +28,9 @@ include_directories(
 include_directories(${Boost_INCLUDE_DIRS})
 link_directories(${Boost_LIBRARY_DIRS})
 
+include_directories(${LOG4CXX_INCLUDE_DIRS})
+link_directories(${LOG4CXX_LIBRARY_DIRS})
+
 ########################################################################
 # Setup library
 ########################################################################
@@ -60,6 +63,7 @@ GR_INCLUDE_SUBDIRECTORY(gsm)
 list(APPEND vocoder_libs
     gnuradio-core
     ${Boost_LIBRARIES}
+    ${LOG4CXX_LIBRARIES}
 )
 
 add_library(gnuradio-vocoder SHARED ${gr_vocoder_sources})
diff --git a/gr-wavelet/lib/CMakeLists.txt b/gr-wavelet/lib/CMakeLists.txt
index f0d9068b75..16a0bdc876 100644
--- a/gr-wavelet/lib/CMakeLists.txt
+++ b/gr-wavelet/lib/CMakeLists.txt
@@ -36,6 +36,9 @@ link_directories(${Boost_LIBRARY_DIRS})
 include_directories(${GSL_INCLUDE_DIRS})
 link_directories(${GSL_LIBRARY_DIRS})
 
+include_directories(${LOG4CXX_INCLUDE_DIRS})
+link_directories(${LOG4CXX_LIBRARY_DIRS})
+
 ########################################################################
 # Setup library
 ########################################################################
@@ -50,6 +53,7 @@ list(APPEND wavelet_libs
     ${Boost_LIBRARIES}
     ${WAVELET_LIBRARIES}
     ${GSL_LIBRARIES}
+    ${LOG4CXX_LIBRARIES}
 )
 
 add_library(gnuradio-wavelet SHARED ${gr_wavelet_sources})
-- 
cgit v1.2.3


From a87c609beb6aef9b584c7ff638cdffe7e3637e97 Mon Sep 17 00:00:00 2001
From: Tom Rondeau <trondeau@vt.edu>
Date: Mon, 11 Jun 2012 15:42:55 -0400
Subject: log: Restructure config file handling for gr-log.

The xml config file is installed into prefix/etc/gnuradio.

A new LOG section is added to gnuradio-core.conf that has an item log_file to point to the log file to be used.

If the log_file is not found, we can now set the file to "" to use the BasicConfigurator for very simple console logging. This is what will be used during 'make test'.

In gr_fir_sysconfig_x86.cc, all std::cerr calls are replaced with gr-log to easily turn them on/off.
---
 docs/doxygen/other/main_page.dox                   |  2 +-
 gnuradio-core/CMakeLists.txt                       | 16 +++-
 gnuradio-core/gnuradio-core.conf                   |  7 --
 gnuradio-core/gnuradio-core.conf.in                | 14 ++++
 gnuradio-core/gr_log_default.xml                   | 64 +++++++++++++++
 .../src/lib/filter/gr_fir_sysconfig_x86.cc         | 91 +++++++++++++++-------
 gnuradio-core/src/lib/runtime/CMakeLists.txt       |  8 --
 gnuradio-core/src/lib/runtime/gr_log.cc            | 13 ++++
 gnuradio-core/src/lib/runtime/gr_log.h             | 23 +-----
 gnuradio-core/src/lib/runtime/gr_log_default.xml   | 64 ---------------
 10 files changed, 174 insertions(+), 128 deletions(-)
 delete mode 100644 gnuradio-core/gnuradio-core.conf
 create mode 100644 gnuradio-core/gnuradio-core.conf.in
 create mode 100644 gnuradio-core/gr_log_default.xml
 delete mode 100644 gnuradio-core/src/lib/runtime/gr_log_default.xml

(limited to 'docs/doxygen')

diff --git a/docs/doxygen/other/main_page.dox b/docs/doxygen/other/main_page.dox
index 8f47ed0d74..ec8642de66 100644
--- a/docs/doxygen/other/main_page.dox
+++ b/docs/doxygen/other/main_page.dox
@@ -86,7 +86,7 @@ default configuration script is located at:
 In a class, we must first configure the logger and then get access to it:
 
 \code
-  GR_CONFIG_LOGGER("prefix/share/gnuradio/gr_log_default.xml");
+  GR_CONFIG_LOGGER("prefix/etc/gnuradio/conf.d/gr_log_default.xml");
   GR_LOG_GETLOGGER(LOG, name);
 \endcode
 
diff --git a/gnuradio-core/CMakeLists.txt b/gnuradio-core/CMakeLists.txt
index 0227108446..9ff7ed0a04 100644
--- a/gnuradio-core/CMakeLists.txt
+++ b/gnuradio-core/CMakeLists.txt
@@ -107,12 +107,26 @@ CPACK_COMPONENT("core_swig"
     DEPENDS      "gruel_swig;core_python;core_devel"
 )
 
+# Setup configure file
+configure_file(
+    ${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-core.conf.in
+    ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-core.conf
+@ONLY)
+
 install(
-    FILES gnuradio-core.conf
+    FILES ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-core.conf
     DESTINATION ${GR_PKG_CONF_DIR}
     COMPONENT "core_runtime"
 )
 
+if(ENABLE_GR_LOG)
+install(FILES
+    ${CMAKE_CURRENT_SOURCE_DIR}/gr_log_default.xml
+    DESTINATION ${GR_CONF_DIR}/gnuradio
+    COMPONENT "core_runtime"
+)
+endif(ENABLE_GR_LOG)
+
 ########################################################################
 # Add subdirectories
 ########################################################################
diff --git a/gnuradio-core/gnuradio-core.conf b/gnuradio-core/gnuradio-core.conf
deleted file mode 100644
index 178b288e8d..0000000000
--- a/gnuradio-core/gnuradio-core.conf
+++ /dev/null
@@ -1,7 +0,0 @@
-# This file contains system wide configuration data for GNU Radio.
-# You may override any setting on a per-user basis by editing
-# ~/.gnuradio/config.conf
-
-[DEFAULT]
-
-verbose = False
diff --git a/gnuradio-core/gnuradio-core.conf.in b/gnuradio-core/gnuradio-core.conf.in
new file mode 100644
index 0000000000..dad07cd245
--- /dev/null
+++ b/gnuradio-core/gnuradio-core.conf.in
@@ -0,0 +1,14 @@
+# This file contains system wide configuration data for GNU Radio.
+# You may override any setting on a per-user basis by editing
+# ~/.gnuradio/config.conf
+
+[DEFAULT]
+
+verbose = False
+
+
+[LOG]
+
+log_config = @CMAKE_INSTALL_PREFIX@/etc/gnuradio/gr_log_default.xml
+log_level = all
+debug_level = DEBUG
diff --git a/gnuradio-core/gr_log_default.xml b/gnuradio-core/gr_log_default.xml
new file mode 100644
index 0000000000..be721bb021
--- /dev/null
+++ b/gnuradio-core/gr_log_default.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!-- 
+ * Copyright 2006,2010,2011 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ * 
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+-->
+
+ <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+  
+  <appender name="RootConsoleAppender" class="org.apache.log4j.ConsoleAppender">    
+    <param name="Target" value="System.out"/>
+        <layout class="org.apache.log4j.PatternLayout">
+            <param name="ConversionPattern" value="Root :%-5p %c{1} - %m%n"/>
+        </layout>
+  </appender>
+
+  <!--Add appender to root to log ALL msgs in one place-->
+  <root>
+        <priority value="all" />
+  </root>
+
+  <appender name="errLogRootConsoleAppender" class="org.apache.log4j.ConsoleAppender">    
+    <param name="Target" value="System.out"/>
+        <layout class="org.apache.log4j.PatternLayout">
+            <param name="ConversionPattern" value="errLoggerRoot :%-5p %c{1} - %m%n"/>
+        </layout>
+  </appender>
+
+  <!-- Specify the level for some specific loggers-->
+  <category name="gr_log" >
+        <priority value ="all" />
+        <appender-ref ref="errLogRootConsoleAppender"/>
+  </category>
+
+  <appender name="errConsoleAppender" class="org.apache.log4j.ConsoleAppender">    
+    <param name="Target" value="System.out"/>
+        <layout class="org.apache.log4j.PatternLayout">
+            <param name="ConversionPattern" value="err :%-5p %c{1} - %m%n"/>
+        </layout>
+  </appender>
+
+   <category name="gr_log_debug" >
+        <priority value ="DEBUG" />
+        <appender-ref ref="errConsoleAppender"/>
+  </category>
+
+ </log4j:configuration>
+
diff --git a/gnuradio-core/src/lib/filter/gr_fir_sysconfig_x86.cc b/gnuradio-core/src/lib/filter/gr_fir_sysconfig_x86.cc
index 97b8106994..4e3598c5d4 100644
--- a/gnuradio-core/src/lib/filter/gr_fir_sysconfig_x86.cc
+++ b/gnuradio-core/src/lib/filter/gr_fir_sysconfig_x86.cc
@@ -48,8 +48,8 @@
 // #include <gr_fir_sss_mmx.h>
 // #include <gr_fir_sss_sse2.h>
 
-#include <iostream>
-using std::cerr;
+#include <gr_prefs.h>
+#include <gr_log.h>
 
 /*
  * ----------------------------------------------------------------
@@ -177,9 +177,13 @@ gr_fir_sysconfig_x86::create_gr_fir_ccf (const std::vector<float> &taps)
 {
   static bool first = true;
 
+  std::string log_file = gr_prefs::singleton()->get_string("LOG", "log_config", "");
+  GR_CONFIG_LOGGER(log_file);
+  GR_LOG_GETLOGGER(LOG, "gr_log.gr_fir_sysconfig_x86");
+
   if (gr_cpu::has_3dnow ()){
     if (first){
-      cerr << ">>> gr_fir_ccf: using 3DNow!\n";
+      GR_LOG_TRACE(LOG, "gr_fir_ccf: using 3DNow!");
       first = false;
     }
     return make_gr_fir_ccf_3dnow (taps);
@@ -187,14 +191,14 @@ gr_fir_sysconfig_x86::create_gr_fir_ccf (const std::vector<float> &taps)
 
   if (gr_cpu::has_sse ()){
     if (first){
-      cerr << ">>> gr_fir_ccf: using SSE\n";
+      GR_LOG_TRACE(LOG, "gr_fir_ccf: using SSE");
       first = false;
     }
     return make_gr_fir_ccf_sse (taps);
   }
 
   if (first){
-    cerr << ">>> gr_fir_ccf: handing off to parent class\n";
+    GR_LOG_TRACE(LOG, "gr_fir_ccf: handing off to parent class");
     first = false;
   }
   return gr_fir_sysconfig_generic::create_gr_fir_ccf (taps);
@@ -205,9 +209,13 @@ gr_fir_sysconfig_x86::create_gr_fir_fcc (const std::vector<gr_complex> &taps)
 {
   static bool first = true;
 
+  std::string log_file = gr_prefs::singleton()->get_string("LOG", "log_config", "");
+  GR_CONFIG_LOGGER(log_file);
+  GR_LOG_GETLOGGER(LOG, "gr_log.gr_fir_sysconfig_x86");
+
   if (gr_cpu::has_3dnow ()){
     if (first){
-      cerr << ">>> gr_fir_fcc: using 3DNow!\n";
+      GR_LOG_TRACE(LOG, "gr_fir_fcc: gr_fir_fcc: using 3DNow!");
       first = false;
     }
     return make_gr_fir_fcc_3dnow (taps);
@@ -215,14 +223,14 @@ gr_fir_sysconfig_x86::create_gr_fir_fcc (const std::vector<gr_complex> &taps)
 
   if (gr_cpu::has_sse ()){
     if (first){
-      cerr << ">>> gr_fir_fcc: using SSE\n";
+      GR_LOG_TRACE(LOG, "gr_fir_fcc: gr_fir_fcc: using SSE");
       first = false;
     }
     return make_gr_fir_fcc_sse (taps);
   }
 
   if (first){
-    cerr << ">>> gr_fir_fcc: handing off to parent class\n";
+    GR_LOG_TRACE(LOG, "gr_fir_fcc: handing off to parent class");
     first = false;
   }
   return gr_fir_sysconfig_generic::create_gr_fir_fcc (taps);
@@ -233,9 +241,13 @@ gr_fir_sysconfig_x86::create_gr_fir_ccc (const std::vector<gr_complex> &taps)
 {
   static bool first = true;
 
+  std::string log_file = gr_prefs::singleton()->get_string("LOG", "log_config", "");
+  GR_CONFIG_LOGGER(log_file);
+  GR_LOG_GETLOGGER(LOG, "gr_log.gr_fir_sysconfig_x86");
+
   if (gr_cpu::has_3dnowext ()){
     if (first) {
-      cerr << ">>> gr_fir_ccc: using 3DNow!Ext\n";
+      GR_LOG_TRACE(LOG, "gr_fir_ccc: using 3DNow!Ext");
       first = false;
     }
     return make_gr_fir_ccc_3dnowext (taps);
@@ -243,7 +255,7 @@ gr_fir_sysconfig_x86::create_gr_fir_ccc (const std::vector<gr_complex> &taps)
 
   if (gr_cpu::has_3dnow ()){
     if (first) {
-      cerr << ">>> gr_fir_ccc: using 3DNow!\n";
+      GR_LOG_TRACE(LOG, "gr_fir_ccc: using 3DNow!");
       first = false;
     }
     return make_gr_fir_ccc_3dnow (taps);
@@ -251,14 +263,14 @@ gr_fir_sysconfig_x86::create_gr_fir_ccc (const std::vector<gr_complex> &taps)
 
   if (gr_cpu::has_sse ()){
     if (first){
-      cerr << ">>> gr_fir_ccc: using SSE\n";
+      GR_LOG_TRACE(LOG, "gr_fir_ccc: using SSE");
       first = false;
     }
     return make_gr_fir_ccc_sse (taps);
   }
 
   if (first){
-    cerr << ">>> gr_fir_ccc: handing off to parent class\n";
+    GR_LOG_TRACE(LOG, "gr_fir_ccc: handing off to parent class");
     first = false;
   }
   return gr_fir_sysconfig_generic::create_gr_fir_ccc (taps);
@@ -269,9 +281,13 @@ gr_fir_sysconfig_x86::create_gr_fir_fff (const std::vector<float> &taps)
 {
   static bool first = true;
 
+  std::string log_file = gr_prefs::singleton()->get_string("LOG", "log_config", "");
+  GR_CONFIG_LOGGER(log_file);
+  GR_LOG_GETLOGGER(LOG, "gr_log.gr_fir_sysconfig_x86");
+
   if (gr_cpu::has_3dnow ()){
     if (first) {
-      cerr << ">>> gr_fir_fff: using 3DNow!\n";
+      GR_LOG_TRACE(LOG, "gr_fir_fff: using 3DNow!");
       first = false;
     }
     return make_gr_fir_fff_3dnow (taps);
@@ -279,14 +295,14 @@ gr_fir_sysconfig_x86::create_gr_fir_fff (const std::vector<float> &taps)
 
   if (gr_cpu::has_sse ()){
     if (first){
-      cerr << ">>> gr_fir_fff: using SSE\n";
+      GR_LOG_TRACE(LOG, "gr_fir_fff: using SSE");
       first = false;
     }
     return make_gr_fir_fff_sse (taps);
   }
 
   if (first){
-    cerr << ">>> gr_fir_fff: handing off to parent class\n";
+    GR_LOG_TRACE(LOG, "gr_fir_fff: handing off to parent class");
     first = false;
   }
   return gr_fir_sysconfig_generic::create_gr_fir_fff (taps);
@@ -297,9 +313,13 @@ gr_fir_sysconfig_x86::create_gr_fir_fsf (const std::vector<float> &taps)
 {
   static bool first = true;
 
+  std::string log_file = gr_prefs::singleton()->get_string("LOG", "log_config", "");
+  GR_CONFIG_LOGGER(log_file);
+  GR_LOG_GETLOGGER(LOG, "gr_log.gr_fir_sysconfig_x86");
+
   if (gr_cpu::has_3dnow ()){
     if (first) {
-      cerr << ">>> gr_fir_fsf: using 3DNow!\n";
+      GR_LOG_TRACE(LOG, "gr_fir_fsf: using 3DNow!");
       first = false;
     }
     return make_gr_fir_fsf_3dnow (taps);
@@ -307,14 +327,14 @@ gr_fir_sysconfig_x86::create_gr_fir_fsf (const std::vector<float> &taps)
 
   if (gr_cpu::has_sse ()){
     if (first){
-      cerr << ">>> gr_fir_fsf: using SSE\n";
+      GR_LOG_TRACE(LOG, "gr_fir_fsf: using SSE");
       first = false;
     }
     return make_gr_fir_fsf_sse (taps);
   }
 
   if (first){
-    cerr << ">>> gr_fir_fsf: handing off to parent class\n";
+    GR_LOG_TRACE(LOG, "gr_fir_fsf: handing off to parent class");
     first = false;
   }
   return gr_fir_sysconfig_generic::create_gr_fir_fsf (taps);
@@ -326,19 +346,30 @@ gr_fir_sysconfig_x86::create_gr_fir_sss (const std::vector<short> &taps)
 {
   // FIXME -- probably want to figure out best answer for Athlon and code
   // add code to select it here...
+  static bool first = true;
+
+  std::string log_file = gr_prefs::singleton()->get_string("LOG", "log_config", "");
+  GR_CONFIG_LOGGER(log_file);
+  GR_LOG_GETLOGGER(LOG, "gr_log.gr_fir_sysconfig_x86");
 
   if (gr_cpu::has_sse2 ()){
-    cerr << ">>> gr_fir_sss: using SSE2\n";
-    return make_gr_fir_sss_sse2 (taps);
+    if(first) {
+      GR_LOG_TRACE(LOG, "gr_fir_sss: using SSE2");
+      return make_gr_fir_sss_sse2 (taps);
+    }
   }
 
   if (gr_cpu::has_mmx ()){
-    cerr << ">>> gr_fir_sss: using MMX\n";
-    return make_gr_fir_sss_mmx (taps);
+    if(first) {
+      GR_LOG_TRACE(LOG, "gr_fir_sss: using MMX");
+      return make_gr_fir_sss_mmx (taps);
+    }
   }
 
-  cerr << ">>> gr_fir_sss: handing off to parent class\n";
-  return gr_fir_sysconfig_generic::create_gr_fir_sss (taps);
+  if(first) {
+    GR_LOG_TRACE(LOG, "gr_fir_sss: handing off to parent class");
+    return gr_fir_sysconfig_generic::create_gr_fir_sss (taps);
+  }
 }
 #endif
 
@@ -347,9 +378,13 @@ gr_fir_sysconfig_x86::create_gr_fir_scc (const std::vector<gr_complex> &taps)
 {
   static bool first = true;
 
+  std::string log_file = gr_prefs::singleton()->get_string("LOG", "log_config", "");
+  GR_CONFIG_LOGGER(log_file);
+  GR_LOG_GETLOGGER(LOG, "gr_log.gr_fir_sysconfig_x86");
+
   if (gr_cpu::has_3dnowext ()){
     if (first){
-      cerr << ">>> gr_fir_scc: using 3DNow!Ext\n";
+      GR_LOG_TRACE(LOG, "gr_fir_scc: using 3DNow!Ext");
       first = false;
     }
     return make_gr_fir_scc_3dnowext (taps);
@@ -357,7 +392,7 @@ gr_fir_sysconfig_x86::create_gr_fir_scc (const std::vector<gr_complex> &taps)
 
   if (gr_cpu::has_3dnow ()){
     if (first){
-      cerr << ">>> gr_fir_scc: using 3DNow!\n";
+      GR_LOG_TRACE(LOG, "gr_fir_scc: using 3DNow!");
       first = false;
     }
     return make_gr_fir_scc_3dnow (taps);
@@ -365,14 +400,14 @@ gr_fir_sysconfig_x86::create_gr_fir_scc (const std::vector<gr_complex> &taps)
 
   if (gr_cpu::has_sse ()){
     if (first){
-      cerr << ">>> gr_fir_scc: using SSE\n";
+      GR_LOG_TRACE(LOG, "gr_fir_scc: using SSE");
       first = false;
     }
     return make_gr_fir_scc_sse (taps);
   }
 
   if (first){
-    cerr << ">>> gr_fir_scc: handing off to parent class\n";
+    GR_LOG_TRACE(LOG, "gr_fir_scc: handing off to parent class");
     first = false;
   }
   return gr_fir_sysconfig_generic::create_gr_fir_scc (taps);
diff --git a/gnuradio-core/src/lib/runtime/CMakeLists.txt b/gnuradio-core/src/lib/runtime/CMakeLists.txt
index e36e83e84f..b5fde7d03c 100644
--- a/gnuradio-core/src/lib/runtime/CMakeLists.txt
+++ b/gnuradio-core/src/lib/runtime/CMakeLists.txt
@@ -165,11 +165,3 @@ install(FILES
 )
     
 endif(ENABLE_PYTHON)
-
-if(ENABLE_GR_LOG)
-install(FILES
-    ${CMAKE_CURRENT_SOURCE_DIR}/gr_log_default.xml
-    DESTINATION ${GR_PKG_DATA_DIR}
-    COMPONENT "core_runtime"
-)
-endif(ENABLE_GR_LOG)
diff --git a/gnuradio-core/src/lib/runtime/gr_log.cc b/gnuradio-core/src/lib/runtime/gr_log.cc
index 5478bd70c0..7af55b155c 100644
--- a/gnuradio-core/src/lib/runtime/gr_log.cc
+++ b/gnuradio-core/src/lib/runtime/gr_log.cc
@@ -39,3 +39,16 @@
 
 #include <gr_log.h>
 
+void
+logger_load_config(const std::string &config_filename)
+{
+  if(config_filename.size() == 0) {
+    BasicConfigurator::configure();
+  }
+  else if(config_filename.find(".xml") != std::string::npos) {
+    DOMConfigurator::configure(config_filename);
+  }
+  else {
+    PropertyConfigurator::configure(config_filename);
+  }
+}
diff --git a/gnuradio-core/src/lib/runtime/gr_log.h b/gnuradio-core/src/lib/runtime/gr_log.h
index 4f718567df..9050b70eb3 100644
--- a/gnuradio-core/src/lib/runtime/gr_log.h
+++ b/gnuradio-core/src/lib/runtime/gr_log.h
@@ -46,6 +46,7 @@
 
 #include <log4cxx/logger.h>
 #include <log4cxx/logmanager.h>
+#include <log4cxx/basicconfigurator.h>
 #include <log4cxx/xml/domconfigurator.h>
 #include <log4cxx/propertyconfigurator.h>
 
@@ -135,16 +136,7 @@ using namespace log4cxx::helpers;
 
 
 // Load configuration file
-void
-logger_load_config(std::string config_filename)
-{
-  if(config_filename.find(".xml") != std::string::npos) {
-    DOMConfigurator::configure(config_filename);
-  }
-  else {
-    PropertyConfigurator::configure(config_filename);
-  }
-}
+void logger_load_config(const std::string &config_filename="");
 
 /*!
  * \brief instantiate (configure) logger.
@@ -179,15 +171,8 @@ class gr_log
 
   static LoggerPtr getLogger(std::string name)
   {
-    if(LogManager::exists(name)) {
-      LoggerPtr logger = Logger::getLogger(name);
-      return logger;
-    }
-    else {
-      LoggerPtr logger = Logger::getLogger(name);
-      logger->setLevel(log4cxx::Level::getOff());
-      return logger;
-    }
+    LoggerPtr logger = Logger::getLogger(name);
+    return logger;
   };
 
   // Wrappers for logging macros
diff --git a/gnuradio-core/src/lib/runtime/gr_log_default.xml b/gnuradio-core/src/lib/runtime/gr_log_default.xml
deleted file mode 100644
index be721bb021..0000000000
--- a/gnuradio-core/src/lib/runtime/gr_log_default.xml
+++ /dev/null
@@ -1,64 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!-- 
- * Copyright 2006,2010,2011 Free Software Foundation, Inc.
- * 
- * This file is part of GNU Radio
- * 
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- * 
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
--->
-
- <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
-  
-  <appender name="RootConsoleAppender" class="org.apache.log4j.ConsoleAppender">    
-    <param name="Target" value="System.out"/>
-        <layout class="org.apache.log4j.PatternLayout">
-            <param name="ConversionPattern" value="Root :%-5p %c{1} - %m%n"/>
-        </layout>
-  </appender>
-
-  <!--Add appender to root to log ALL msgs in one place-->
-  <root>
-        <priority value="all" />
-  </root>
-
-  <appender name="errLogRootConsoleAppender" class="org.apache.log4j.ConsoleAppender">    
-    <param name="Target" value="System.out"/>
-        <layout class="org.apache.log4j.PatternLayout">
-            <param name="ConversionPattern" value="errLoggerRoot :%-5p %c{1} - %m%n"/>
-        </layout>
-  </appender>
-
-  <!-- Specify the level for some specific loggers-->
-  <category name="gr_log" >
-        <priority value ="all" />
-        <appender-ref ref="errLogRootConsoleAppender"/>
-  </category>
-
-  <appender name="errConsoleAppender" class="org.apache.log4j.ConsoleAppender">    
-    <param name="Target" value="System.out"/>
-        <layout class="org.apache.log4j.PatternLayout">
-            <param name="ConversionPattern" value="err :%-5p %c{1} - %m%n"/>
-        </layout>
-  </appender>
-
-   <category name="gr_log_debug" >
-        <priority value ="DEBUG" />
-        <appender-ref ref="errConsoleAppender"/>
-  </category>
-
- </log4j:configuration>
-
-- 
cgit v1.2.3


From 9e299d568123f8df5188d0850311cb7f5b5e11f2 Mon Sep 17 00:00:00 2001
From: Tom Rondeau <trondeau@vt.edu>
Date: Wed, 13 Jun 2012 09:50:09 -0400
Subject: log: added a macro and routine to set log level from config file.

Also worked on documentation of logging features.
---
 docs/doxygen/other/main_page.dox                   | 57 ++++++++++++++-----
 .../src/lib/filter/gr_fir_sysconfig_x86.cc         | 14 +++++
 gnuradio-core/src/lib/runtime/gr_log.cc            | 35 ++++++++++++
 gnuradio-core/src/lib/runtime/gr_log.h             | 65 +++++++++++++++++++++-
 gnuradio-core/src/lib/runtime/gr_log.i             |  5 ++
 5 files changed, 160 insertions(+), 16 deletions(-)

(limited to 'docs/doxygen')

diff --git a/docs/doxygen/other/main_page.dox b/docs/doxygen/other/main_page.dox
index ec8642de66..cd948c3058 100644
--- a/docs/doxygen/other/main_page.dox
+++ b/docs/doxygen/other/main_page.dox
@@ -81,13 +81,35 @@ 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:
 
-    $prefix/share/gnuradio/gr_log_default.xml
+    $prefix/etc/gnuradio/gr_log_default.xml
 
-In a class, we must first configure the logger and then get access to it:
+However, we use the global GNU Radio configuration file to tell the
+system where this file is located. In the [LOG] section of the
+configuration file, the location of the logger's XML file can be
+specified. The default configuration file is found in:
+
+    $prefix/etc/gnuradio/conf.d/gnuradio-core.conf
+
+A local "~/.gnuradio/config.conf" file can be used to override any
+parameter in the global file.
+
+For the following examples, we will assume that our local
+"~/.gnuradio/config.conf" looks like this:
+
+\code
+[LOG]
+log_file = /opt/gr/etc/gnuadio/gr_log_default.xml
+log_level = All
+\endcode
+
+The startup and configuration process proceeds as follows.
 
 \code
-  GR_CONFIG_LOGGER("prefix/etc/gnuradio/conf.d/gr_log_default.xml");
-  GR_LOG_GETLOGGER(LOG, name);
+  std::string log_file = gr_prefs::singleton()->get_string("LOG", "log_config", "");
+  std::string log_level = gr_prefs::singleton()->get_string("LOG", "log_level", "off");
+  GR_CONFIG_LOGGER(log_file);
+  GR_LOG_GETLOGGER(LOG, <name>);
+  GR_LOG_SET_LEVEL(LOG, log_level);
 \endcode
 
 The default config file has two names that can be used (as std::string
@@ -95,6 +117,9 @@ types): "gr_log" and "gr_log_debug". The first one will print
 all levels of logging informaiton while the second one will only print
 Debug and above.
 
+Names of loggers are global, so "gr_log" as a name will be the same
+logger no matter where it is picked from.
+
 The "LOG" name for the logger is now a LoggerPtr object and can be
 named anything.
 
@@ -107,17 +132,19 @@ something like "gr_log.costas_loop". This will inherit all properties
 of the parent logger, "gr_log".
 
 After calling "GR_LOG_GETLOGGER", the LoggerPtr that was specified,
-"LOG" in the example above, is used to set the properties. For
-instance, the level for any logger can be easily modified using the
-setLogger(level) method, such as:
-
-\code
-  LOG->setLevel(log4cxx::Level::getAll());
-\endcode
-
-In this case, the "getAll()" method sets the logger's level to log
-everything. Other methods are "getDebug()", "getInfo()", and so on for
-the different levels of logging.
+"LOG" in the example above, is used to set the properties. The main
+setting we are generally interested in is the level of the
+logger. This will determine if this logger gets outputted or not. In
+this case, we are actually getting the gr_log level from the GNU Radio
+configuration file, stored in log_level. The macro GR_LOG_SET_LEVEL
+can take either a string or a log4cxx::LevelPtr object. The log_level
+variable in this case holds a string read in from the config file, and
+it's case insensitive. I can be "off", "all", "trace", "debug",
+"info", "warn", "error", or "fatal" to match with the levels above.
+
+In our example here, all logging information is displayed because the
+config file specifies "All". We can then easily turn off all reporting
+by setting this value to "Off".
 
 The various logging macros are defined in gr_log.h. Here are some
 simple exmaples of using them:
diff --git a/gnuradio-core/src/lib/filter/gr_fir_sysconfig_x86.cc b/gnuradio-core/src/lib/filter/gr_fir_sysconfig_x86.cc
index 4e3598c5d4..a218015154 100644
--- a/gnuradio-core/src/lib/filter/gr_fir_sysconfig_x86.cc
+++ b/gnuradio-core/src/lib/filter/gr_fir_sysconfig_x86.cc
@@ -178,8 +178,10 @@ gr_fir_sysconfig_x86::create_gr_fir_ccf (const std::vector<float> &taps)
   static bool first = true;
 
   std::string log_file = gr_prefs::singleton()->get_string("LOG", "log_config", "");
+  std::string log_level = gr_prefs::singleton()->get_string("LOG", "log_level", "off");
   GR_CONFIG_LOGGER(log_file);
   GR_LOG_GETLOGGER(LOG, "gr_log.gr_fir_sysconfig_x86");
+  GR_LOG_SET_LEVEL(LOG, log_level);
 
   if (gr_cpu::has_3dnow ()){
     if (first){
@@ -210,8 +212,10 @@ gr_fir_sysconfig_x86::create_gr_fir_fcc (const std::vector<gr_complex> &taps)
   static bool first = true;
 
   std::string log_file = gr_prefs::singleton()->get_string("LOG", "log_config", "");
+  std::string log_level = gr_prefs::singleton()->get_string("LOG", "log_level", "off");
   GR_CONFIG_LOGGER(log_file);
   GR_LOG_GETLOGGER(LOG, "gr_log.gr_fir_sysconfig_x86");
+  GR_LOG_SET_LEVEL(LOG, log_level);
 
   if (gr_cpu::has_3dnow ()){
     if (first){
@@ -242,8 +246,10 @@ gr_fir_sysconfig_x86::create_gr_fir_ccc (const std::vector<gr_complex> &taps)
   static bool first = true;
 
   std::string log_file = gr_prefs::singleton()->get_string("LOG", "log_config", "");
+  std::string log_level = gr_prefs::singleton()->get_string("LOG", "log_level", "off");
   GR_CONFIG_LOGGER(log_file);
   GR_LOG_GETLOGGER(LOG, "gr_log.gr_fir_sysconfig_x86");
+  GR_LOG_SET_LEVEL(LOG, log_level);
 
   if (gr_cpu::has_3dnowext ()){
     if (first) {
@@ -282,8 +288,10 @@ gr_fir_sysconfig_x86::create_gr_fir_fff (const std::vector<float> &taps)
   static bool first = true;
 
   std::string log_file = gr_prefs::singleton()->get_string("LOG", "log_config", "");
+  std::string log_level = gr_prefs::singleton()->get_string("LOG", "log_level", "off");
   GR_CONFIG_LOGGER(log_file);
   GR_LOG_GETLOGGER(LOG, "gr_log.gr_fir_sysconfig_x86");
+  GR_LOG_SET_LEVEL(LOG, log_level);
 
   if (gr_cpu::has_3dnow ()){
     if (first) {
@@ -314,8 +322,10 @@ gr_fir_sysconfig_x86::create_gr_fir_fsf (const std::vector<float> &taps)
   static bool first = true;
 
   std::string log_file = gr_prefs::singleton()->get_string("LOG", "log_config", "");
+  std::string log_level = gr_prefs::singleton()->get_string("LOG", "log_level", "off");
   GR_CONFIG_LOGGER(log_file);
   GR_LOG_GETLOGGER(LOG, "gr_log.gr_fir_sysconfig_x86");
+  GR_LOG_SET_LEVEL(LOG, log_level);
 
   if (gr_cpu::has_3dnow ()){
     if (first) {
@@ -349,8 +359,10 @@ gr_fir_sysconfig_x86::create_gr_fir_sss (const std::vector<short> &taps)
   static bool first = true;
 
   std::string log_file = gr_prefs::singleton()->get_string("LOG", "log_config", "");
+  std::string log_level = gr_prefs::singleton()->get_string("LOG", "log_level", "off");
   GR_CONFIG_LOGGER(log_file);
   GR_LOG_GETLOGGER(LOG, "gr_log.gr_fir_sysconfig_x86");
+  GR_LOG_SET_LEVEL(LOG, log_level);
 
   if (gr_cpu::has_sse2 ()){
     if(first) {
@@ -379,8 +391,10 @@ gr_fir_sysconfig_x86::create_gr_fir_scc (const std::vector<gr_complex> &taps)
   static bool first = true;
 
   std::string log_file = gr_prefs::singleton()->get_string("LOG", "log_config", "");
+  std::string log_level = gr_prefs::singleton()->get_string("LOG", "log_level", "off");
   GR_CONFIG_LOGGER(log_file);
   GR_LOG_GETLOGGER(LOG, "gr_log.gr_fir_sysconfig_x86");
+  GR_LOG_SET_LEVEL(LOG, log_level);
 
   if (gr_cpu::has_3dnowext ()){
     if (first){
diff --git a/gnuradio-core/src/lib/runtime/gr_log.cc b/gnuradio-core/src/lib/runtime/gr_log.cc
index 7af55b155c..9be3ba04fd 100644
--- a/gnuradio-core/src/lib/runtime/gr_log.cc
+++ b/gnuradio-core/src/lib/runtime/gr_log.cc
@@ -38,6 +38,9 @@
 #endif
 
 #include <gr_log.h>
+#include <stdexcept>
+#include <algorithm>
+
 
 void
 logger_load_config(const std::string &config_filename)
@@ -52,3 +55,35 @@ logger_load_config(const std::string &config_filename)
     PropertyConfigurator::configure(config_filename);
   }
 }
+
+void
+logger_set_level(LoggerPtr logger, const std::string &level)
+{
+  std::string nocase = level;
+  std::transform(level.begin(), level.end(), nocase.begin(), ::tolower);
+  
+  if(nocase == "off")
+    logger_set_level(logger, log4cxx::Level::getOff());
+  else if(nocase == "all")
+    logger_set_level(logger, log4cxx::Level::getAll());
+  else if(nocase == "trace")
+    logger_set_level(logger, log4cxx::Level::getTrace());
+  else if(nocase == "debug")
+    logger_set_level(logger, log4cxx::Level::getDebug());
+  else if(nocase == "info")
+    logger_set_level(logger, log4cxx::Level::getInfo());
+  else if(nocase == "warn")
+    logger_set_level(logger, log4cxx::Level::getWarn());
+  else if(nocase == "error")
+    logger_set_level(logger, log4cxx::Level::getError());
+  else if(nocase == "fatal")
+    logger_set_level(logger, log4cxx::Level::getFatal());
+  else
+    throw std::runtime_error("logger_set_level: Bad level type.\n");
+}
+
+void
+logger_set_level(LoggerPtr logger, log4cxx::LevelPtr level)
+{
+  logger->setLevel(level);
+}
diff --git a/gnuradio-core/src/lib/runtime/gr_log.h b/gnuradio-core/src/lib/runtime/gr_log.h
index 9050b70eb3..e932257a32 100644
--- a/gnuradio-core/src/lib/runtime/gr_log.h
+++ b/gnuradio-core/src/lib/runtime/gr_log.h
@@ -74,6 +74,13 @@ using namespace log4cxx::helpers;
 #define GR_LOG_GETLOGGER(logger, name) \
   LoggerPtr logger = gr_log::getLogger(name);
 
+#define GR_LOG_SET_LEVEL(logger, level) \
+  logger_set_level(logger, level);
+
+#define GR_SET_LEVEL(name, level) \
+  LoggerPtr logger = Logger::getLogger(name); \
+  logger_set_level(logger, level);
+
 /* Logger name referenced macros */
 #define GR_TRACE(name, msg) { \
   LoggerPtr logger = Logger::getLogger(name); \
@@ -135,9 +142,57 @@ using namespace log4cxx::helpers;
   assert(cond);}
 
 
-// Load configuration file
+/*!
+ * \brief Load logger's configuration file.
+ *
+ * Initialize the GNU Radio logger by loading the configuration file
+ * \p config_filename.
+ *
+ * \param config_filename The configuration file. Set to "" for the
+ *        basic logger that outputs to the console.
+ */
 void logger_load_config(const std::string &config_filename="");
 
+/*!
+ * \brief Set the logger's output level.
+ *
+ * Sets the level of the logger. This takes a string that is
+ * translated to the standard levels and can be (case insensitive):
+ *
+ * \li off
+ * \li all
+ * \li trace
+ * \li debug
+ * \li info
+ * \li warn
+ * \li error
+ * \li fatal
+ *
+ * \param logger the logger to set the level of.
+ * \param level  string to set the level to.
+ */
+void logger_set_level(LoggerPtr logger, const std::string &level);
+
+/*!
+ * \brief Set the logger's output level.
+ *
+ * Sets the level of the logger. This takes the actual Log4cxx::Level
+ * data type, which can be:
+ *
+ * \li Log4cxx::Level::getOff()
+ * \li Log4cxx::Level::getAll()
+ * \li Log4cxx::Level::getTrace()
+ * \li Log4cxx::Level::getDebug()
+ * \li Log4cxx::Level::getInfo()
+ * \li Log4cxx::Level::getWarn()
+ * \li Log4cxx::Level::getError()
+ * \li Log4cxx::Level::getFatal()
+ *
+ * \param logger the logger to set the level of.
+ * \param level  new logger level of type Log4cxx::Level
+ */
+void logger_set_level(LoggerPtr logger, log4cxx::LevelPtr level);
+
 /*!
  * \brief instantiate (configure) logger.
  * \ingroup logging
@@ -175,6 +230,9 @@ class gr_log
     return logger;
   };
 
+  /*! \brief inline function, wrapper to set the logger level */
+  void set_level(std::string name,std::string level){GR_SET_LEVEL(name,level);}
+  
   // Wrappers for logging macros
   /*! \brief inline function, wrapper for LOG4CXX_TRACE for TRACE message */
   void trace(std::string name,std::string msg){GR_TRACE(name,msg);};
@@ -200,6 +258,10 @@ class gr_log
   /*! \brief inline function, wrapper for LOG4CXX_ASSERT for conditional ERROR message */
   void gr_assert(std::string name,bool cond,std::string msg){GR_ASSERT(name,cond,msg);};
 
+
+  /*! \brief inline function, wrapper to set the logger level */
+  void set_log_level(LoggerPtr logger,std::string level){GR_LOG_SET_LEVEL(logger,level);}
+
   /*! \brief inline function, wrapper for LOG4CXX_TRACE for TRACE message */
   void log_trace(LoggerPtr logger,std::string msg){GR_LOG_TRACE(logger,msg);};
 
@@ -231,6 +293,7 @@ class gr_log
 
 #define GR_CONFIG_LOGGER(config)
 #define GR_LOG_GETLOGGER(logger, name) 
+#define GR_LOG_SET_LEVEL(logger, level)
 #define GR_TRACE(name, msg)
 #define GR_DEBUG(name, msg)
 #define GR_INFO(name, msg)
diff --git a/gnuradio-core/src/lib/runtime/gr_log.i b/gnuradio-core/src/lib/runtime/gr_log.i
index e539c5528b..4c9cc4f255 100644
--- a/gnuradio-core/src/lib/runtime/gr_log.i
+++ b/gnuradio-core/src/lib/runtime/gr_log.i
@@ -54,6 +54,9 @@ public:
  ~LoggerPtr();
 };
 
+void logger_load_config(const std::string &config_filename);
+void logger_set_level(LoggerPtr logger, const std::string &level);
+
 class gr_log
 {
 private:
@@ -61,6 +64,7 @@ private:
 public:
 //   gr_log(std::string config_filename);
   gr_log(std::string config_filename,int watchPeriodSec);
+  void set_level(std::string name,std::string level);
   void trace(std::string name,std::string msg);
   void debug(std::string name,std::string msg);
   void info(std::string name,std::string msg);
@@ -72,6 +76,7 @@ public:
 
   static LoggerPtr getLogger(std::string name);
 
+  void set_log_level(LoggerPtr logger,std::string level);
   void log_trace(LoggerPtr logger,std::string msg);
   void log_debug(LoggerPtr logger,std::string msg);
   void log_info(LoggerPtr logger,std::string msg);
-- 
cgit v1.2.3


From 9c0f2dea1c3dc661d53f182f4c6b82c713f4de44 Mon Sep 17 00:00:00 2001
From: Tom Rondeau <trondeau@vt.edu>
Date: Thu, 6 Sep 2012 12:02:27 -0400
Subject: log: fixups after merge.

---
 docs/doxygen/other/extra_pages.dox | 2 ++
 gnuradio-core/CMakeLists.txt       | 2 +-
 gr-digital/lib/CMakeLists.txt      | 1 -
 3 files changed, 3 insertions(+), 2 deletions(-)

(limited to 'docs/doxygen')

diff --git a/docs/doxygen/other/extra_pages.dox b/docs/doxygen/other/extra_pages.dox
index d40c692e03..44cdf9d483 100644
--- a/docs/doxygen/other/extra_pages.dox
+++ b/docs/doxygen/other/extra_pages.dox
@@ -79,6 +79,8 @@ audio-osx and audio-windows to be either satisfied or built.
 \subsection dep_gr_comedi gr-comedi: Comedi hardware interface
 \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
 
 
 \section build_gr_cmake Building GNU Radio
diff --git a/gnuradio-core/CMakeLists.txt b/gnuradio-core/CMakeLists.txt
index aed16c563d..7a35551525 100644
--- a/gnuradio-core/CMakeLists.txt
+++ b/gnuradio-core/CMakeLists.txt
@@ -115,7 +115,7 @@ configure_file(
 @ONLY)
 
 install(
-    FILES gnuradio-core.conf
+    FILES ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-core.conf
     DESTINATION ${GR_PREFSDIR}
     COMPONENT "core_runtime"
 )
diff --git a/gr-digital/lib/CMakeLists.txt b/gr-digital/lib/CMakeLists.txt
index 6c2aba941d..7bb5b9bc88 100644
--- a/gr-digital/lib/CMakeLists.txt
+++ b/gr-digital/lib/CMakeLists.txt
@@ -87,7 +87,6 @@ endmacro(expand_cc)
 # Invoke macro to generate various sources
 ########################################################################
 expand_cc(digital_chunks_to_symbols_XX         bf bc sf sc if ic)
->>>>>>> master
 
 ########################################################################
 # Setup library
-- 
cgit v1.2.3


From 4fd16922d4e7ae2e5fd9dd048a873cbef409a7ff Mon Sep 17 00:00:00 2001
From: Tom Rondeau <trondeau@vt.edu>
Date: Fri, 1 Mar 2013 13:19:11 -0500
Subject: log: adding default loggers to all gr_blocks to make using them
 simpler. log: improving logger configuration and default behavior. log:
 changed name from gr_log to gr_logger (felt it could be confuse with the math
 function log). docs: moved logging information out to its own page.

---
 cmake/Modules/GrMiscUtils.cmake                    |  43 +-
 docs/doxygen/other/logger.dox                      | 202 +++++++++
 gnuradio-core/gnuradio-core.conf.in                |  14 +-
 gnuradio-core/gr_log_default.xml                   |   6 +-
 .../src/lib/filter/gr_fir_sysconfig_x86.cc         |  90 +---
 gnuradio-core/src/lib/runtime/CMakeLists.txt       |   8 +-
 gnuradio-core/src/lib/runtime/gr_block.cc          |  47 ++
 gnuradio-core/src/lib/runtime/gr_block.h           |   6 +
 gnuradio-core/src/lib/runtime/gr_log.cc            | 112 -----
 gnuradio-core/src/lib/runtime/gr_log.h             | 380 ----------------
 gnuradio-core/src/lib/runtime/gr_log.i             |  94 ----
 gnuradio-core/src/lib/runtime/gr_logger.cc         | 189 ++++++++
 gnuradio-core/src/lib/runtime/gr_logger.h          | 498 +++++++++++++++++++++
 gnuradio-core/src/lib/runtime/gr_logger.i          |  96 ++++
 gnuradio-core/src/lib/runtime/qa_gr_log.cc         |  51 ---
 gnuradio-core/src/lib/runtime/qa_gr_log.h          |  42 --
 gnuradio-core/src/lib/runtime/qa_gr_logger.cc      |  51 +++
 gnuradio-core/src/lib/runtime/qa_gr_logger.h       |  42 ++
 gnuradio-core/src/lib/runtime/qa_runtime.cc        |   4 +-
 gnuradio-core/src/lib/runtime/runtime.i            |   4 +-
 gr-filter/lib/CMakeLists.txt                       |   6 +-
 21 files changed, 1209 insertions(+), 776 deletions(-)
 create mode 100644 docs/doxygen/other/logger.dox
 delete mode 100644 gnuradio-core/src/lib/runtime/gr_log.cc
 delete mode 100644 gnuradio-core/src/lib/runtime/gr_log.h
 delete mode 100644 gnuradio-core/src/lib/runtime/gr_log.i
 create mode 100644 gnuradio-core/src/lib/runtime/gr_logger.cc
 create mode 100644 gnuradio-core/src/lib/runtime/gr_logger.h
 create mode 100644 gnuradio-core/src/lib/runtime/gr_logger.i
 delete mode 100644 gnuradio-core/src/lib/runtime/qa_gr_log.cc
 delete mode 100644 gnuradio-core/src/lib/runtime/qa_gr_log.h
 create mode 100644 gnuradio-core/src/lib/runtime/qa_gr_logger.cc
 create mode 100644 gnuradio-core/src/lib/runtime/qa_gr_logger.h

(limited to 'docs/doxygen')

diff --git a/cmake/Modules/GrMiscUtils.cmake b/cmake/Modules/GrMiscUtils.cmake
index 088b4e0af1..751aad5b4c 100644
--- a/cmake/Modules/GrMiscUtils.cmake
+++ b/cmake/Modules/GrMiscUtils.cmake
@@ -210,7 +210,7 @@ function(GR_GEN_TARGET_DEPS name var)
 endfunction(GR_GEN_TARGET_DEPS)
 
 ########################################################################
-# Control use of gr_log
+# Control use of gr_logger
 # Usage:
 #   GR_LOGGING()
 #
@@ -220,26 +220,35 @@ endfunction(GR_GEN_TARGET_DEPS)
 function(GR_LOGGING)
   find_package(Log4cxx)
 
-  OPTION(ENABLE_GR_LOG "Use gr_log" ON)
-  
-  if(NOT LOG4CXX_FOUND)
-    SET(ENABLE_GR_LOG OFF)
-  endif(NOT LOG4CXX_FOUND)
-
-  message(STATUS "ENABLE_GR_LOG set to ${ENABLE_GR_LOG}.")
-
-  SET(ENABLE_GR_LOG ${ENABLE_GR_LOG} CACHE INTERNAL "" FORCE)
-  
+  OPTION(ENABLE_GR_LOG "Use gr_logger" ON)
   if(ENABLE_GR_LOG)
+    # If gr_logger is enabled, make it usable
     add_definitions( -DENABLE_GR_LOG )
+
+    # also test LOG4CXX; if we have it, use this version of the logger
+    # otherwise, default to the stdout/stderr model.
+    if(LOG4CXX_FOUND)
+      SET(HAVE_LOG4CXX True)
+      add_definitions( -DHAVE_LOG4CXX )
+    else(LOG4CXX_FOUND)
+      SET(HAVE_LOG4CXX False)
+      SET(LOG4CXX_INCLUDE_DIRS "")
+      SET(LOG4CXX_LIBRARY_DIRS "")
+      SET(LOG4CXX_LIBRARIES "")
+    endif(LOG4CXX_FOUND)
+
+    SET(ENABLE_GR_LOG ${ENABLE_GR_LOG} CACHE INTERNAL "" FORCE)
+
   else(ENABLE_GR_LOG)
-    # If not enabled or available, set these variable to
-    # blank so we can use them later without having to
-    # check ENABLE_GR_LOG each time.
-    SET(LOG4CXX_INCLUDE_DIRS "" CACHE INTERNAL "" FORCE)
-    SET(LOG4CXX_LIBRARY_DIRS "" CACHE INTERNAL "" FORCE)
-    SET(LOG4CXX_LIBRARIES "" CACHE INTERNAL "" FORCE)
+    SET(HAVE_LOG4CXX False)
+    SET(LOG4CXX_INCLUDE_DIRS)
+    SET(LOG4CXX_LIBRARY_DIRS)
+    SET(LOG4CXX_LIBRARIES)
   endif(ENABLE_GR_LOG)
+
+  message(STATUS "ENABLE_GR_LOG set to ${ENABLE_GR_LOG}.")
+  message(STATUS "HAVE_LOG4CXX set to ${HAVE_LOG4CXX}.")
+
 endfunction(GR_LOGGING)
 
 ########################################################################
diff --git a/docs/doxygen/other/logger.dox b/docs/doxygen/other/logger.dox
new file mode 100644
index 0000000000..f98a64657b
--- /dev/null
+++ b/docs/doxygen/other/logger.dox
@@ -0,0 +1,202 @@
+/*! \page page_logger Logging
+
+\section logging Logging
+
+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
+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
+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
+
+The order here determines the level of output. These levels are
+hierarchical in that specifying any level also includes any level
+above it. For example, when using the Debug level, all Debug and
+higher messages are logged and Trace is ignored.
+
+\subsection configfile Logging Configuration
+
+The logging configuration can be found in the gnuradio-core.conf file
+under the [LOG] section. This allows us fairly complete control over
+the logging facilities. The main configuration functions are to set up
+the level of the loggers and set the default output behavior of the
+loggers.
+
+There are two default loggers that all gr_block's have access to:
+d_logger and d_debug_logger. The first is a standard logger meant to
+output simple information about the block while it is running. The
+debug logger is meant for debugging purposes and is added to make it
+convenient to use a secondary logger that outputs to a different
+stream or file.
+
+The four main configure options are:
+
+<pre>
+  log_level = all
+  debug_level = all
+  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
+use files but instead output to the console. The standard logger will
+output to standard out while the debug logger outputs to standard
+error.
+
+Changing these last two lines to another value will create files that
+are used to store the log messages. All messages are appended to the
+file.
+
+When using either standard error or standard out, the messages for the
+two different loggers will look like:
+
+<pre>
+  gr::log :\<level\>: \<block alias\> - \<message\>
+  gr::debug :\<level\>: \<block alias\> - \<message\>
+</pre>
+
+When using a file, the only difference in the format is that the
+message prefix of "gr::log" or "gr::debug" is not used. Instead, the
+time in milliseconds from the start of the program is inserted.
+
+Remember that a local "~/.gnuradio/config.conf" file can be used to
+override any parameter in the global file (see \ref prefs for more
+details).
+
+To use these loggers inside of a GNU Radio block, we use the protected
+data members of d_logger and d_debug_logger of gr_block and pass them
+to our pre-defined macros:
+
+\code
+  GR_LOG_<level>(<logger>, "<Message to print>");
+\endcode
+
+Where \<level\> is one of the levels as mentioned above, \<logger\> is
+either d_logger or d_debug_logger, and \<Message to print\> is the
+message we want to output. If we wanted to output an INFO level
+message to the standard logger and a WARN level message to the debug
+logger, it would look like this:
+
+\code
+  GR_LOG_INFO(d_logger, "Some info about the block");
+  GR_LOG_WARN(d_debug_logger, "Some warning about the block");
+\endcode
+
+When this is printed to wherever you are directing the output of the
+logger, it will look like:
+
+<pre>
+    gr::log :INFO: <block's alias> - Some info about the block
+    gr::debug :WARN: <block's alias> - Some warning about the block
+</pre>
+
+This provides us information about where the message came from, the
+level of the message, and the block that generated the message. We use
+the concept of the block's alias which by default (i.e., unless
+otherwise set by the user) includes the name of the block and a unique
+ID to distinguish it from other blocks of the same type.
+
+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_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");
+\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 log4cxx library is not found, then TRACE,
+DEBUG, and INFO levels go to stdout and the rest to stderr.
+
+
+\subsection adv_config Advanced Configuration Options
+
+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:
+
+<pre>
+    $prefix/etc/gnuradio/gr_log_default.xml
+</pre>
+
+For the following examples, we will assume that our local
+"~/.gnuradio/config.conf" looks like this:
+
+\code
+[LOG]
+log_config = /opt/gr/etc/gnuadio/gr_log_default.xml
+log_level = All
+debug_level = Off
+\endcode
+
+Inside of the XML default configuration file, we define the parameters
+for the two logger's, the standard logger the separate debug logger.
+
+If the levels of the two loggers are specified in our configuration
+file, as in the above example, these levels override any levels
+specified in the XML file. Here, we have turned on the standard logger
+(d_logger) to all levels and turned off the debug 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."
+
+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
+actually used. So you can configure file access and the pattern
+through the XML file while also still outputting to stdout or stderr.
+
+
+\section advlog Advanced Usage
+
+The description above for using the logging facilities is specific to
+GNU Radio blocks. We have put the code necessary to access the
+debugger into the gr_block parent class to simplify access and make
+sure all blocks have the ability to quickly and easily use the logger.
+
+For non gr_block-based code, we have to get some information about the
+logger in order to properly access it. Each logger only exists once as
+a singleton in the system, but we need to get a pointer to the right
+logger and then set it up for our local use. The following code
+snippet shows how to do this to get access to the standard logger,
+which has a root of "gr_log." (access to the debug logger is similar
+except we would use "gr_log_debug." in the GR_LOG_GETLOGGER call):
+
+\code
+    gr_prefs *p = gr_prefs::singleton();
+    std::string log_file = p->get_string("LOG", "log_config", "");
+    std::string log_level = p->get_string("LOG", "log_level", "off");
+    GR_CONFIG_LOGGER(log_file);
+    GR_LOG_GETLOGGER(LOG, "gr_log." + "my_logger_name");
+    GR_LOG_SET_LEVEL(LOG, log_level);
+\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
+input to our logging macros like 'GR_LOG_TRACE(LOG, "message")'.
+
+*/
diff --git a/gnuradio-core/gnuradio-core.conf.in b/gnuradio-core/gnuradio-core.conf.in
index 6ddc56df27..3e6db27a99 100644
--- a/gnuradio-core/gnuradio-core.conf.in
+++ b/gnuradio-core/gnuradio-core.conf.in
@@ -6,9 +6,19 @@
 verbose = False
 
 [LOG]
-log_config = @CMAKE_INSTALL_PREFIX@/etc/gnuradio/gr_log_default.xml
 log_level = all
-debug_level = DEBUG
+debug_level = all
+
+# These file names can either be 'stdout' to output to standard output
+# or 'stderr' to output to standard error. Any other string will
+# create a file in which to output the logging information. An empty
+# string or no value here will ignore this level of configuration
+# completely.
+log_file = stdout
+debug_file = stderr
+
+# Used for advanced configuration of the logger
+#log_config = @CMAKE_INSTALL_PREFIX@/etc/gnuradio/gr_log_default.xml
 
 [PerfCounters]
 on = False
diff --git a/gnuradio-core/gr_log_default.xml b/gnuradio-core/gr_log_default.xml
index 4260c0e12f..13b854c7e8 100644
--- a/gnuradio-core/gr_log_default.xml
+++ b/gnuradio-core/gr_log_default.xml
@@ -26,7 +26,7 @@
   <appender name="RootConsoleAppender" class="org.apache.log4j.ConsoleAppender">    
     <param name="Target" value="System.out"/>
         <layout class="org.apache.log4j.PatternLayout">
-            <param name="ConversionPattern" value="Root :%-5p %c{1} - %m%n"/>
+            <param name="ConversionPattern" value="Root :%p: %c{1} - %m%n"/>
         </layout>
   </appender>
 
@@ -38,7 +38,7 @@
   <appender name="errLogRootConsoleAppender" class="org.apache.log4j.ConsoleAppender">    
     <param name="Target" value="System.out"/>
         <layout class="org.apache.log4j.PatternLayout">
-            <param name="ConversionPattern" value="grlog :%-5p %c{1} - %m%n"/>
+            <param name="ConversionPattern" value="gr::log :%p: %c{1} - %m%n"/>
         </layout>
   </appender>
 
@@ -51,7 +51,7 @@
   <appender name="errConsoleAppender" class="org.apache.log4j.ConsoleAppender">    
     <param name="Target" value="System.out"/>
         <layout class="org.apache.log4j.PatternLayout">
-            <param name="ConversionPattern" value="err :%-5p %c{1} - %m%n"/>
+            <param name="ConversionPattern" value="gr::debug :%p: %c{1} - %m%n"/>
         </layout>
   </appender>
 
diff --git a/gnuradio-core/src/lib/filter/gr_fir_sysconfig_x86.cc b/gnuradio-core/src/lib/filter/gr_fir_sysconfig_x86.cc
index a218015154..ab61806691 100644
--- a/gnuradio-core/src/lib/filter/gr_fir_sysconfig_x86.cc
+++ b/gnuradio-core/src/lib/filter/gr_fir_sysconfig_x86.cc
@@ -49,7 +49,7 @@
 // #include <gr_fir_sss_sse2.h>
 
 #include <gr_prefs.h>
-#include <gr_log.h>
+#include <gr_logger.h>
 
 /*
  * ----------------------------------------------------------------
@@ -177,15 +177,9 @@ gr_fir_sysconfig_x86::create_gr_fir_ccf (const std::vector<float> &taps)
 {
   static bool first = true;
 
-  std::string log_file = gr_prefs::singleton()->get_string("LOG", "log_config", "");
-  std::string log_level = gr_prefs::singleton()->get_string("LOG", "log_level", "off");
-  GR_CONFIG_LOGGER(log_file);
-  GR_LOG_GETLOGGER(LOG, "gr_log.gr_fir_sysconfig_x86");
-  GR_LOG_SET_LEVEL(LOG, log_level);
-
   if (gr_cpu::has_3dnow ()){
     if (first){
-      GR_LOG_TRACE(LOG, "gr_fir_ccf: using 3DNow!");
+      cerr << ">>> gr_fir_ccf: using 3DNow!\n";
       first = false;
     }
     return make_gr_fir_ccf_3dnow (taps);
@@ -193,14 +187,14 @@ gr_fir_sysconfig_x86::create_gr_fir_ccf (const std::vector<float> &taps)
 
   if (gr_cpu::has_sse ()){
     if (first){
-      GR_LOG_TRACE(LOG, "gr_fir_ccf: using SSE");
+      cer << ">>> gr_fir_ccf: using SSE\n";
       first = false;
     }
     return make_gr_fir_ccf_sse (taps);
   }
 
   if (first){
-    GR_LOG_TRACE(LOG, "gr_fir_ccf: handing off to parent class");
+    cer << ">>> gr_fir_ccf: handing off to parent class\n";
     first = false;
   }
   return gr_fir_sysconfig_generic::create_gr_fir_ccf (taps);
@@ -211,15 +205,9 @@ gr_fir_sysconfig_x86::create_gr_fir_fcc (const std::vector<gr_complex> &taps)
 {
   static bool first = true;
 
-  std::string log_file = gr_prefs::singleton()->get_string("LOG", "log_config", "");
-  std::string log_level = gr_prefs::singleton()->get_string("LOG", "log_level", "off");
-  GR_CONFIG_LOGGER(log_file);
-  GR_LOG_GETLOGGER(LOG, "gr_log.gr_fir_sysconfig_x86");
-  GR_LOG_SET_LEVEL(LOG, log_level);
-
   if (gr_cpu::has_3dnow ()){
     if (first){
-      GR_LOG_TRACE(LOG, "gr_fir_fcc: gr_fir_fcc: using 3DNow!");
+      cerr << ">>> gr_fir_fcc: gr_fir_fcc: using 3DNow!\n";
       first = false;
     }
     return make_gr_fir_fcc_3dnow (taps);
@@ -227,14 +215,14 @@ gr_fir_sysconfig_x86::create_gr_fir_fcc (const std::vector<gr_complex> &taps)
 
   if (gr_cpu::has_sse ()){
     if (first){
-      GR_LOG_TRACE(LOG, "gr_fir_fcc: gr_fir_fcc: using SSE");
+      cerr << ">>> gr_fir_fcc: gr_fir_fcc: using SSE\n";
       first = false;
     }
     return make_gr_fir_fcc_sse (taps);
   }
 
   if (first){
-    GR_LOG_TRACE(LOG, "gr_fir_fcc: handing off to parent class");
+    cerr << ">>> gr_fir_fcc: handing off to parent class\n";
     first = false;
   }
   return gr_fir_sysconfig_generic::create_gr_fir_fcc (taps);
@@ -245,15 +233,9 @@ gr_fir_sysconfig_x86::create_gr_fir_ccc (const std::vector<gr_complex> &taps)
 {
   static bool first = true;
 
-  std::string log_file = gr_prefs::singleton()->get_string("LOG", "log_config", "");
-  std::string log_level = gr_prefs::singleton()->get_string("LOG", "log_level", "off");
-  GR_CONFIG_LOGGER(log_file);
-  GR_LOG_GETLOGGER(LOG, "gr_log.gr_fir_sysconfig_x86");
-  GR_LOG_SET_LEVEL(LOG, log_level);
-
   if (gr_cpu::has_3dnowext ()){
     if (first) {
-      GR_LOG_TRACE(LOG, "gr_fir_ccc: using 3DNow!Ext");
+      cerr << ">>> gr_fir_ccc: using 3DNow!Ext\n";
       first = false;
     }
     return make_gr_fir_ccc_3dnowext (taps);
@@ -261,7 +243,7 @@ gr_fir_sysconfig_x86::create_gr_fir_ccc (const std::vector<gr_complex> &taps)
 
   if (gr_cpu::has_3dnow ()){
     if (first) {
-      GR_LOG_TRACE(LOG, "gr_fir_ccc: using 3DNow!");
+      cerr << ">>> gr_fir_ccc: using 3DNow!\n";
       first = false;
     }
     return make_gr_fir_ccc_3dnow (taps);
@@ -269,14 +251,14 @@ gr_fir_sysconfig_x86::create_gr_fir_ccc (const std::vector<gr_complex> &taps)
 
   if (gr_cpu::has_sse ()){
     if (first){
-      GR_LOG_TRACE(LOG, "gr_fir_ccc: using SSE");
+      cerr << ">>> gr_fir_ccc: using SSE\n";
       first = false;
     }
     return make_gr_fir_ccc_sse (taps);
   }
 
   if (first){
-    GR_LOG_TRACE(LOG, "gr_fir_ccc: handing off to parent class");
+    cerr << ">>> gr_fir_ccc: handing off to parent class\n";
     first = false;
   }
   return gr_fir_sysconfig_generic::create_gr_fir_ccc (taps);
@@ -287,15 +269,9 @@ gr_fir_sysconfig_x86::create_gr_fir_fff (const std::vector<float> &taps)
 {
   static bool first = true;
 
-  std::string log_file = gr_prefs::singleton()->get_string("LOG", "log_config", "");
-  std::string log_level = gr_prefs::singleton()->get_string("LOG", "log_level", "off");
-  GR_CONFIG_LOGGER(log_file);
-  GR_LOG_GETLOGGER(LOG, "gr_log.gr_fir_sysconfig_x86");
-  GR_LOG_SET_LEVEL(LOG, log_level);
-
   if (gr_cpu::has_3dnow ()){
     if (first) {
-      GR_LOG_TRACE(LOG, "gr_fir_fff: using 3DNow!");
+      cerr << ">>> gr_fir_fff: using 3DNow!\n";
       first = false;
     }
     return make_gr_fir_fff_3dnow (taps);
@@ -303,14 +279,14 @@ gr_fir_sysconfig_x86::create_gr_fir_fff (const std::vector<float> &taps)
 
   if (gr_cpu::has_sse ()){
     if (first){
-      GR_LOG_TRACE(LOG, "gr_fir_fff: using SSE");
+      cerr << ">>> gr_fir_fff: using SSE\n";
       first = false;
     }
     return make_gr_fir_fff_sse (taps);
   }
 
   if (first){
-    GR_LOG_TRACE(LOG, "gr_fir_fff: handing off to parent class");
+    cerr << ">>> gr_fir_fff: handing off to parent class\n";
     first = false;
   }
   return gr_fir_sysconfig_generic::create_gr_fir_fff (taps);
@@ -321,15 +297,9 @@ gr_fir_sysconfig_x86::create_gr_fir_fsf (const std::vector<float> &taps)
 {
   static bool first = true;
 
-  std::string log_file = gr_prefs::singleton()->get_string("LOG", "log_config", "");
-  std::string log_level = gr_prefs::singleton()->get_string("LOG", "log_level", "off");
-  GR_CONFIG_LOGGER(log_file);
-  GR_LOG_GETLOGGER(LOG, "gr_log.gr_fir_sysconfig_x86");
-  GR_LOG_SET_LEVEL(LOG, log_level);
-
   if (gr_cpu::has_3dnow ()){
     if (first) {
-      GR_LOG_TRACE(LOG, "gr_fir_fsf: using 3DNow!");
+      cerr << ">>> gr_fir_fsf: using 3DNow!\n";
       first = false;
     }
     return make_gr_fir_fsf_3dnow (taps);
@@ -337,14 +307,14 @@ gr_fir_sysconfig_x86::create_gr_fir_fsf (const std::vector<float> &taps)
 
   if (gr_cpu::has_sse ()){
     if (first){
-      GR_LOG_TRACE(LOG, "gr_fir_fsf: using SSE");
+      cerr << ">>> gr_fir_fsf: using SSE\n";
       first = false;
     }
     return make_gr_fir_fsf_sse (taps);
   }
 
   if (first){
-    GR_LOG_TRACE(LOG, "gr_fir_fsf: handing off to parent class");
+    cerr << ">>> gr_fir_fsf: handing off to parent class\n";
     first = false;
   }
   return gr_fir_sysconfig_generic::create_gr_fir_fsf (taps);
@@ -358,28 +328,22 @@ gr_fir_sysconfig_x86::create_gr_fir_sss (const std::vector<short> &taps)
   // add code to select it here...
   static bool first = true;
 
-  std::string log_file = gr_prefs::singleton()->get_string("LOG", "log_config", "");
-  std::string log_level = gr_prefs::singleton()->get_string("LOG", "log_level", "off");
-  GR_CONFIG_LOGGER(log_file);
-  GR_LOG_GETLOGGER(LOG, "gr_log.gr_fir_sysconfig_x86");
-  GR_LOG_SET_LEVEL(LOG, log_level);
-
   if (gr_cpu::has_sse2 ()){
     if(first) {
-      GR_LOG_TRACE(LOG, "gr_fir_sss: using SSE2");
+      cerr << ">>> gr_fir_sss: using SSE2\n";
       return make_gr_fir_sss_sse2 (taps);
     }
   }
 
   if (gr_cpu::has_mmx ()){
     if(first) {
-      GR_LOG_TRACE(LOG, "gr_fir_sss: using MMX");
+      cerr << ">>> gr_fir_sss: using MMX\n";
       return make_gr_fir_sss_mmx (taps);
     }
   }
 
   if(first) {
-    GR_LOG_TRACE(LOG, "gr_fir_sss: handing off to parent class");
+    cerr << ">>> gr_fir_sss: handing off to parent class\n";
     return gr_fir_sysconfig_generic::create_gr_fir_sss (taps);
   }
 }
@@ -390,15 +354,9 @@ gr_fir_sysconfig_x86::create_gr_fir_scc (const std::vector<gr_complex> &taps)
 {
   static bool first = true;
 
-  std::string log_file = gr_prefs::singleton()->get_string("LOG", "log_config", "");
-  std::string log_level = gr_prefs::singleton()->get_string("LOG", "log_level", "off");
-  GR_CONFIG_LOGGER(log_file);
-  GR_LOG_GETLOGGER(LOG, "gr_log.gr_fir_sysconfig_x86");
-  GR_LOG_SET_LEVEL(LOG, log_level);
-
   if (gr_cpu::has_3dnowext ()){
     if (first){
-      GR_LOG_TRACE(LOG, "gr_fir_scc: using 3DNow!Ext");
+      cerr << ">>> gr_fir_scc: using 3DNow!Ext\n";
       first = false;
     }
     return make_gr_fir_scc_3dnowext (taps);
@@ -406,7 +364,7 @@ gr_fir_sysconfig_x86::create_gr_fir_scc (const std::vector<gr_complex> &taps)
 
   if (gr_cpu::has_3dnow ()){
     if (first){
-      GR_LOG_TRACE(LOG, "gr_fir_scc: using 3DNow!");
+      cerr << ">>> gr_fir_scc: using 3DNow!\n";
       first = false;
     }
     return make_gr_fir_scc_3dnow (taps);
@@ -414,14 +372,14 @@ gr_fir_sysconfig_x86::create_gr_fir_scc (const std::vector<gr_complex> &taps)
 
   if (gr_cpu::has_sse ()){
     if (first){
-      GR_LOG_TRACE(LOG, "gr_fir_scc: using SSE");
+      cerr << ">>> gr_fir_scc: using SSE\n";
       first = false;
     }
     return make_gr_fir_scc_sse (taps);
   }
 
   if (first){
-    GR_LOG_TRACE(LOG, "gr_fir_scc: handing off to parent class");
+    cerr << ">>> gr_fir_scc: handing off to parent class\n";
     first = false;
   }
   return gr_fir_sysconfig_generic::create_gr_fir_scc (taps);
diff --git a/gnuradio-core/src/lib/runtime/CMakeLists.txt b/gnuradio-core/src/lib/runtime/CMakeLists.txt
index 1f8156edd1..6772f7a26d 100644
--- a/gnuradio-core/src/lib/runtime/CMakeLists.txt
+++ b/gnuradio-core/src/lib/runtime/CMakeLists.txt
@@ -62,7 +62,7 @@ list(APPEND gnuradio_core_sources
     ${CMAKE_CURRENT_SOURCE_DIR}/gr_error_handler.cc
     ${CMAKE_CURRENT_SOURCE_DIR}/gr_io_signature.cc
     ${CMAKE_CURRENT_SOURCE_DIR}/gr_local_sighandler.cc
-    ${CMAKE_CURRENT_SOURCE_DIR}/gr_log.cc
+    ${CMAKE_CURRENT_SOURCE_DIR}/gr_logger.cc
     ${CMAKE_CURRENT_SOURCE_DIR}/gr_message.cc
     ${CMAKE_CURRENT_SOURCE_DIR}/gr_msg_accepter.cc
     ${CMAKE_CURRENT_SOURCE_DIR}/gr_msg_handler.cc
@@ -106,7 +106,7 @@ list(APPEND test_gnuradio_core_sources
     ${CMAKE_CURRENT_SOURCE_DIR}/qa_block_tags.cc
     ${CMAKE_CURRENT_SOURCE_DIR}/qa_runtime.cc
     ${CMAKE_CURRENT_SOURCE_DIR}/qa_set_msg_handler.cc
-    ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_log.cc
+    ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_logger.cc
 )
 
 ########################################################################
@@ -128,7 +128,7 @@ install(FILES
     ${CMAKE_CURRENT_SOURCE_DIR}/gr_error_handler.h
     ${CMAKE_CURRENT_SOURCE_DIR}/gr_io_signature.h
     ${CMAKE_CURRENT_SOURCE_DIR}/gr_local_sighandler.h
-    ${CMAKE_CURRENT_SOURCE_DIR}/gr_log.h
+    ${CMAKE_CURRENT_SOURCE_DIR}/gr_logger.h
     ${CMAKE_CURRENT_SOURCE_DIR}/gr_message.h
     ${CMAKE_CURRENT_SOURCE_DIR}/gr_msg_accepter.h
     ${CMAKE_CURRENT_SOURCE_DIR}/gr_msg_handler.h
@@ -173,7 +173,7 @@ install(FILES
     ${CMAKE_CURRENT_SOURCE_DIR}/gr_dispatcher.i
     ${CMAKE_CURRENT_SOURCE_DIR}/gr_error_handler.i
     ${CMAKE_CURRENT_SOURCE_DIR}/gr_io_signature.i
-    ${CMAKE_CURRENT_SOURCE_DIR}/gr_log.i
+    ${CMAKE_CURRENT_SOURCE_DIR}/gr_logger.i
     ${CMAKE_CURRENT_SOURCE_DIR}/gr_message.i
     ${CMAKE_CURRENT_SOURCE_DIR}/gr_msg_handler.i
     ${CMAKE_CURRENT_SOURCE_DIR}/gr_msg_queue.i
diff --git a/gnuradio-core/src/lib/runtime/gr_block.cc b/gnuradio-core/src/lib/runtime/gr_block.cc
index 54d2676203..0dc9fe670d 100644
--- a/gnuradio-core/src/lib/runtime/gr_block.cc
+++ b/gnuradio-core/src/lib/runtime/gr_block.cc
@@ -29,6 +29,7 @@
 #include <stdexcept>
 #include <iostream>
 #include <gr_block_registry.h>
+#include <gr_prefs.h>
 
 gr_block::gr_block (const std::string &name,
                     gr_io_signature_sptr input_signature,
@@ -49,6 +50,52 @@ gr_block::gr_block (const std::string &name,
     d_min_output_buffer(std::max(output_signature->max_streams(),1), -1)
 {
     global_block_registry.register_primitive(alias(), this);
+
+#ifdef ENABLE_GR_LOG
+#ifdef HAVE_LOG4CXX
+    gr_prefs *p = gr_prefs::singleton();
+    std::string config_file = p->get_string("LOG", "log_config", "");
+    std::string log_level = p->get_string("LOG", "log_level", "off");
+    std::string log_file = p->get_string("LOG", "log_file", "");
+    std::string debug_level = p->get_string("LOG", "debug_level", "off");
+    std::string debug_file = p->get_string("LOG", "debug_file", "");
+
+    GR_CONFIG_LOGGER(config_file);
+
+    GR_LOG_GETLOGGER(LOG, "gr_log." + alias());
+    GR_LOG_SET_LEVEL(LOG, log_level);
+    if(log_file.size() > 0) {
+      if(log_file == "stdout") {
+        GR_LOG_ADD_CONSOLE_APPENDER(LOG, "gr::log :%p: %c{1} - %m%n", "System.out");
+      }
+      else if(log_file == "stderr") {
+        GR_LOG_ADD_CONSOLE_APPENDER(LOG, "gr::log :%p: %c{1} - %m%n", "System.err");
+      }
+      else {
+        GR_LOG_ADD_FILE_APPENDER(LOG, "%r :%p: %c{1} - %m%n", log_file, "");
+      }
+    }
+    d_logger = LOG;
+
+    GR_LOG_GETLOGGER(DLOG, "gr_log_debug." + alias());
+    GR_LOG_SET_LEVEL(DLOG, debug_level);
+    if(debug_file.size() > 0) {
+      if(debug_file == "stdout") {
+        GR_LOG_ADD_CONSOLE_APPENDER(DLOG, "gr::log :%p: %c{1} - %m%n", "System.out");
+      }
+      else if(debug_file == "stderr") {
+        GR_LOG_ADD_CONSOLE_APPENDER(DLOG, "gr::log :%p: %c{1} - %m%n", "System.err");
+      }
+      else {
+        GR_LOG_ADD_FILE_APPENDER(DLOG, "%r :%p: %c{1} - %m%n", debug_file, "");
+      }
+    }
+    d_debug_logger = DLOG;
+#endif /* HAVE_LOG4CXX */
+#else /* ENABLE_GR_LOG */
+    d_logger = NULL;
+    d_debug_logger = NULL;
+#endif /* ENABLE_GR_LOG */
 }
 
 gr_block::~gr_block ()
diff --git a/gnuradio-core/src/lib/runtime/gr_block.h b/gnuradio-core/src/lib/runtime/gr_block.h
index 0783e86848..e4b30267e6 100644
--- a/gnuradio-core/src/lib/runtime/gr_block.h
+++ b/gnuradio-core/src/lib/runtime/gr_block.h
@@ -26,6 +26,7 @@
 #include <gr_core_api.h>
 #include <gr_basic_block.h>
 #include <gr_tags.h>
+#include <gr_logger.h>
 
 /*!
  * \brief The abstract base class for all 'terminal' processing blocks.
@@ -616,6 +617,11 @@ class GR_CORE_API gr_block : public gr_basic_block {
    */ 
   gruel::mutex d_setlock;
 
+  /*! Used by blocks to access the logger system.
+   */ 
+  gr_logger_ptr d_logger;
+  gr_logger_ptr d_debug_logger;
+
   // These are really only for internal use, but leaving them public avoids
   // having to work up an ever-varying list of friend GR_CORE_APIs
 
diff --git a/gnuradio-core/src/lib/runtime/gr_log.cc b/gnuradio-core/src/lib/runtime/gr_log.cc
deleted file mode 100644
index 371878d7f4..0000000000
--- a/gnuradio-core/src/lib/runtime/gr_log.cc
+++ /dev/null
@@ -1,112 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004 Free Software Foundation, Inc.
- * 
- * This file is part of GNU Radio
- * 
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- * 
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-/*
- * config.h is generated by configure.  It contains the results
- * of probing for features, options etc.  It should be the first
- * file included in your .cc file.
- */
-
-/*******************************************************************************
-* Copyright 2011 Johns Hopkins University Applied Physics Lab
-* Author: Mark Plett 
-* Description:
-*   The gr_log module wraps the log4cxx library for logging in gnuradio.
-*******************************************************************************/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h" 
-#endif
-
-#include <gr_log.h>
-#include <stdexcept>
-#include <algorithm>
-
-#ifdef ENABLE_GR_LOG
-
-void
-logger_load_config(const std::string &config_filename)
-{
-  if(config_filename.size() == 0) {
-    log4cxx::BasicConfigurator::configure();
-  }
-  else if(config_filename.find(".xml") != std::string::npos) {
-    log4cxx::xml::DOMConfigurator::configure(config_filename);
-  }
-  else {
-    log4cxx::PropertyConfigurator::configure(config_filename);
-  }
-}
-
-void
-logger_set_level(log4cxx::LoggerPtr logger, const std::string &level)
-{
-  std::string nocase = level;
-  std::transform(level.begin(), level.end(), nocase.begin(), ::tolower);
-  
-  if(nocase == "off")
-    logger_set_level(logger, log4cxx::Level::getOff());
-  else if(nocase == "all")
-    logger_set_level(logger, log4cxx::Level::getAll());
-  else if(nocase == "trace")
-    logger_set_level(logger, log4cxx::Level::getTrace());
-  else if(nocase == "debug")
-    logger_set_level(logger, log4cxx::Level::getDebug());
-  else if(nocase == "info")
-    logger_set_level(logger, log4cxx::Level::getInfo());
-  else if(nocase == "warn")
-    logger_set_level(logger, log4cxx::Level::getWarn());
-  else if(nocase == "error")
-    logger_set_level(logger, log4cxx::Level::getError());
-  else if(nocase == "fatal")
-    logger_set_level(logger, log4cxx::Level::getFatal());
-  else
-    throw std::runtime_error("logger_set_level: Bad level type.\n");
-}
-
-void
-logger_set_level(log4cxx::LoggerPtr logger, log4cxx::LevelPtr level)
-{
-  logger->setLevel(level);
-}
-
-void 
-logger_get_level(log4cxx::LoggerPtr logger,std::string &level)
-{
-  log4cxx::LevelPtr levelPtr = logger->getLevel();
-  if(levelPtr == log4cxx::Level::getOff()) level = "off";
-  if(levelPtr == log4cxx::Level::getAll()) level = "all";
-  if(levelPtr == log4cxx::Level::getTrace()) level = "trace";
-  if(levelPtr == log4cxx::Level::getDebug()) level = "debug";
-  if(levelPtr == log4cxx::Level::getInfo()) level = "info";
-  if(levelPtr == log4cxx::Level::getWarn()) level = "warn";
-  if(levelPtr == log4cxx::Level::getError()) level = "error";
-  if(levelPtr == log4cxx::Level::getFatal()) level = "fatal";
-};
-
-void 
-logger_get_level(log4cxx::LoggerPtr logger,log4cxx::LevelPtr level)
-{
-  level = logger->getLevel();
-}
-
-#endif /* ENABLE_GR_LOG */
diff --git a/gnuradio-core/src/lib/runtime/gr_log.h b/gnuradio-core/src/lib/runtime/gr_log.h
deleted file mode 100644
index 4a0449b203..0000000000
--- a/gnuradio-core/src/lib/runtime/gr_log.h
+++ /dev/null
@@ -1,380 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2012 Free Software Foundation, Inc.
- * 
- * This file is part of GNU Radio
- * 
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- * 
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-/*******************************************************************************
-* Copyright 2011 Johns Hopkins University Applied Physics Lab
-* Author: Mark Plett
-* Description:
-*   The gr_log module wraps the log4cxx library for logging in gnuradio
-*******************************************************************************/
-
-#ifndef INCLUDED_GR_LOG_H
-#define INCLUDED_GR_LOG_H
-
-/*!
-* \file gr_log.h
-* \ingroup logging
-* \brief GNURADIO logging wrapper for log4cxx library (C++ port of log4j)
-*
-*/
-
-#ifdef ENABLE_GR_LOG
-
-#include <gr_core_api.h>
-#include <stdio.h>
-#include <string>
-#include <stdlib.h>
-#include <assert.h>
-
-#include <log4cxx/logger.h>
-#include <log4cxx/logmanager.h>
-#include <log4cxx/basicconfigurator.h>
-#include <log4cxx/xml/domconfigurator.h>
-#include <log4cxx/propertyconfigurator.h>
-
-//using namespace log4cxx;
-//using namespace log4cxx::xml;
-//using namespace log4cxx::helpers;
-
-/*!
- * \brief GR_LOG macros
- * \ingroup logging
- *
- * These macros wrap the standard LOG4CXX_LEVEL macros.  The availablie macros
- * are:
- *  GR_LOG_TRACE
- *  GR_LOG_DEBUG
- *  GR_LOG_INFO
- *  GR_LOG_WARN
- *  GR_LOG_ERROR
- *  GR_LOG_FATAL
- */
-
-#define GR_CONFIG_LOGGER(config)	\
-  logger_load_config(config)
-
-#define GR_LOG_GETLOGGER(logger, name) \
-  log4cxx::LoggerPtr logger = gr_log::getLogger(name);
-
-#define GR_SET_LEVEL(name, level){ \
-  log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(name); \
-  logger_set_level(logger, level);}
-
-#define GR_LOG_SET_LEVEL(logger, level) \
-  logger_set_level(logger, level);
-
-#define GR_GET_LEVEL(name, level){ \
-  log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(name); \
-  logger_get_level(logger,level);}
-
-#define GR_LOG_GET_LEVEL(logger, level) \
-  logger_get_level(logger,level);
-
-
-/* Logger name referenced macros */
-#define GR_TRACE(name, msg) { \
-  log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(name); \
-  LOG4CXX_TRACE(logger, msg);}
-
-#define GR_DEBUG(name, msg) { \
-  log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(name); \
-  LOG4CXX_DEBUG(logger, msg);}
-
-#define GR_INFO(name, msg) { \
-  log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(name); \
-  LOG4CXX_INFO(logger, msg);}
-
-#define GR_WARN(name, msg) { \
-  log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(name); \
-  LOG4CXX_WARN(logger, msg);}
-
-#define GR_ERROR(name, msg) { \
-  log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(name); \
-  LOG4CXX_ERROR(logger, msg);}
-
-#define GR_FATAL(name, msg) { \
-  log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(name); \
-  LOG4CXX_FATAL(logger, msg);}
-
-#define GR_ERRORIF(name, cond, msg) { \
-  log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(name); \
-  LOG4CXX_ASSERT(logger, !(cond), msg);}
-
-#define GR_ASSERT(name, cond, msg) { \
-  log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(name); \
-  LOG4CXX_ASSERT(logger, (cond), msg); \
-  assert((cond));}
-
-/* LoggerPtr Referenced Macros */
-#define GR_LOG_TRACE(logger, msg) { \
-  LOG4CXX_TRACE(logger, msg);}
-
-#define GR_LOG_DEBUG(logger, msg) { \
-  LOG4CXX_DEBUG(logger, msg);}
-
-#define GR_LOG_INFO(logger, msg) { \
-  LOG4CXX_INFO(logger, msg);}
-
-#define GR_LOG_WARN(logger, msg) { \
-  LOG4CXX_WARN(logger, msg);}
-
-#define GR_LOG_ERROR(logger, msg) { \
-  LOG4CXX_ERROR(logger, msg);}
-
-#define GR_LOG_FATAL(logger, msg) { \
-  LOG4CXX_FATAL(logger, msg);}
-
-#define GR_LOG_ERRORIF(logger,cond, msg) { \
-  LOG4CXX_ASSERT(logger, !(cond), msg);}
-
-#define GR_LOG_ASSERT(logger, cond, msg) { \
-  LOG4CXX_ASSERT(logger, (cond), msg); \
-  assert((cond));}
-
-
-/*!
- * \brief Load logger's configuration file.
- *
- * Initialize the GNU Radio logger by loading the configuration file
- * \p config_filename.
- *
- * \param config_filename The configuration file. Set to "" for the
- *        basic logger that outputs to the console.
- */
-GR_CORE_API void logger_load_config(const std::string &config_filename="");
-
-/*!
- * \brief Set the logger's output level.
- *
- * Sets the level of the logger. This takes a string that is
- * translated to the standard levels and can be (case insensitive):
- *
- * \li off
- * \li all
- * \li trace
- * \li debug
- * \li info
- * \li warn
- * \li error
- * \li fatal
- *
- * \param logger the logger to set the level of.
- * \param level  string to set the level to.
- */
-GR_CORE_API void logger_set_level(log4cxx::LoggerPtr logger, const std::string &level);
-
-/*!
- * \brief Set the logger's output level.
- *
- * Sets the level of the logger. This takes the actual Log4cxx::Level
- * data type, which can be:
- *
- * \li log4cxx::Level::getOff()
- * \li log4cxx::Level::getAll()
- * \li log4cxx::Level::getTrace()
- * \li log4cxx::Level::getDebug()
- * \li log4cxx::Level::getInfo()
- * \li log4cxx::Level::getWarn()
- * \li log4cxx::Level::getError()
- * \li log4cxx::Level::getFatal()
- *
- * \param logger the logger to set the level of.
- * \param level  new logger level of type Log4cxx::Level
- */
-void logger_set_level(log4cxx::LoggerPtr logger, log4cxx::LevelPtr level);
-
-
-/*!
- * \brief Get the logger's output level.
- *
- * Gets the level of the logger. This returns a string that
- * corresponds to the standard levels and can be (case insensitive):
- *
- * \li off
- * \li all
- * \li trace
- * \li debug
- * \li info
- * \li warn
- * \li error
- * \li fatal
- *
- * \param logger the logger to get the level of.
- * \param level  string to get the level into.
- */
-GR_CORE_API void logger_get_level(log4cxx::LoggerPtr logger,std::string &level);
-
-/*!
- * \brief Get the logger's output level.
- *
- * Gets the level of the logger. This returns the actual Log4cxx::Level
- * data type, which can be:
- *
- * \li log4cxx::Level::getOff()
- * \li log4cxx::Level::getAll()
- * \li log4cxx::Level::getTrace()
- * \li log4cxx::Level::getDebug()
- * \li log4cxx::Level::getInfo()
- * \li log4cxx::Level::getWarn()
- * \li log4cxx::Level::getError()
- * \li log4cxx::Level::getFatal()
- *
- * \param logger the logger to get the level of.
- */
-void logger_get_level(log4cxx::LoggerPtr logger,log4cxx::LevelPtr level);
-
-
-/*!
- * \brief instantiate (configure) logger.
- * \ingroup logging
- *
- */
-class gr_log
-{
- public:
-  /*!
-   * \brief contructor take log configuration file and configures loggers.
-   */
-  gr_log(std::string config_filename)
-  {
-    // Load configuration file
-    logger_load_config(config_filename);
-  };
-
-  /*!
-   * \brief contructor take log configuration file and watchtime and configures
-   */
-  gr_log(std::string config_filename, int watchPeriodSec)
-  {
-    // Load configuration file
-    if(config_filename.find(".xml")!=std::string::npos) {
-      log4cxx::xml::DOMConfigurator::configureAndWatch(config_filename, watchPeriodSec);
-    }
-    else {
-      log4cxx::PropertyConfigurator::configureAndWatch(config_filename, watchPeriodSec);
-    }
-  };
-
-  static log4cxx::LoggerPtr getLogger(std::string name)
-  {
-    if(log4cxx::LogManager::exists(name)) {
-      log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(name);
-      return logger;
-    }
-    else {
-      log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(name);
-      logger->setLevel(log4cxx::Level::getOff());
-      return logger;
-    };
-  };
-
-  // Wrappers for logging macros
-  /*! \brief inline function, wrapper to set the logger level */
-  void set_level(std::string name,std::string level){GR_SET_LEVEL(name,level);}
-  
-  /*! \brief inline function, wrapper to get the logger level */
-  void get_level(std::string name,std::string &level){GR_GET_LEVEL(name,level);}
-
-  /*! \brief inline function, wrapper for LOG4CXX_TRACE for TRACE message */
-  void trace(std::string name,std::string msg){GR_TRACE(name,msg);};
-
-  /*! \brief inline function, wrapper for LOG4CXX_DEBUG for DEBUG message */
-  void debug(std::string name,std::string msg){GR_DEBUG(name,msg);};
-
-  /*! \brief inline function, wrapper for LOG4CXX_INFO for INFO message */
-  void info(std::string name,std::string msg){GR_INFO(name,msg);};
-
-  /*! \brief inline function, wrapper for LOG4CXX_WARN for WARN message */
-  void warn(std::string name,std::string msg){GR_WARN(name,msg);};
-
-  /*! \brief inline function, wrapper for LOG4CXX_ERROR for ERROR message */
-  void error(std::string name,std::string msg){GR_ERROR(name,msg);};
-
-  /*! \brief inline function, wrapper for LOG4CXX_FATAL for FATAL message */
-  void fatal(std::string name,std::string msg){GR_FATAL(name,msg);};
-
-  /*! \brief inline function, wrapper for LOG4CXX_ASSERT for conditional ERROR message */
-  void errorIF(std::string name,bool cond,std::string msg){GR_ERRORIF(name,cond,msg);};
-
-  /*! \brief inline function, wrapper for LOG4CXX_ASSERT for conditional ERROR message */
-  void gr_assert(std::string name,bool cond,std::string msg){GR_ASSERT(name,cond,msg);};
-
-  // Wrappers for Logger Pointer referenced functions
-  /*! \brief inline function, wrapper to set the logger level */
-  void set_log_level(log4cxx::LoggerPtr logger,std::string level){GR_LOG_SET_LEVEL(logger,level);}
-
-  /*! \brief inline function, wrapper to get the logger level */
-  void get_log_level(log4cxx::LoggerPtr logger,std::string &level){GR_LOG_GET_LEVEL(logger,level);}
-
-  /*! \brief inline function, wrapper for LOG4CXX_TRACE for TRACE message */
-  void log_trace(log4cxx::LoggerPtr logger,std::string msg){GR_LOG_TRACE(logger,msg);};
-
-  /*! \brief inline function, wrapper for LOG4CXX_DEBUG for DEBUG message */
-  void log_debug(log4cxx::LoggerPtr logger,std::string msg){GR_LOG_DEBUG(logger,msg);};
-
-  /*! \brief inline function, wrapper for LOG4CXX_INFO for INFO message */
-  void log_info(log4cxx::LoggerPtr logger,std::string msg){GR_LOG_INFO(logger,msg);};
-
-  /*! \brief inline function, wrapper for LOG4CXX_WARN for WARN message */
-  void log_warn(log4cxx::LoggerPtr logger,std::string msg){GR_LOG_WARN(logger,msg);};
-
-  /*! \brief inline function, wrapper for LOG4CXX_ERROR for ERROR message */
-  void log_error(log4cxx::LoggerPtr logger,std::string msg){GR_LOG_ERROR(logger,msg);};
-
-  /*! \brief inline function, wrapper for LOG4CXX_FATAL for FATAL message */
-  void log_fatal(log4cxx::LoggerPtr logger,std::string msg){GR_LOG_FATAL(logger,msg);};
-
-  /*! \brief inline function, wrapper for LOG4CXX_ASSERT for conditional ERROR message */
-  void log_errorIF(log4cxx::LoggerPtr logger,bool cond,std::string msg){GR_LOG_ERRORIF(logger,cond,msg);};
-
-  /*! \brief inline function, wrapper for LOG4CXX_ASSERT for conditional ERROR message */
-  void log_assert(log4cxx::LoggerPtr logger,bool cond,std::string msg){GR_LOG_ASSERT(logger,cond,msg);};
-};
-
-
-//If ENABLE_GR_LOG not set then clear all logging macros
-#else
-#define GR_CONFIG_LOGGER(config)
-#define GR_LOG_GETLOGGER(logger, name) 
-#define GR_SET_LEVEL(logger, level)
-#define GR_GET_LEVEL(logger, level)
-#define GR_TRACE(name, msg)
-#define GR_DEBUG(name, msg)
-#define GR_INFO(name, msg)
-#define GR_WARN(name, msg) 
-#define GR_ERROR(name, msg) 
-#define GR_FATAL(name, msg) 
-#define GR_ERRORIF(name, cond, msg)
-#define GR_ASSERT(name, cond, msg)
-#define GR_LOG_SET_LEVEL(logger, level)
-#define GR_LOG_GET_LEVEL(logger, level)
-#define GR_LOG_TRACE(logger, msg)
-#define GR_LOG_DEBUG(logger, msg)
-#define GR_LOG_INFO(logger, msg) 
-#define GR_LOG_WARN(logger, msg) 
-#define GR_LOG_ERROR(logger, msg) 
-#define GR_LOG_FATAL(logger, msg) 
-#define GR_LOG_ERRORIF(logger, cond, msg)
-#define GR_LOG_ASSERT(logger, cond, msg)
-
-#endif /* ENABLE_GR_LOG */
-#endif /* INCLUDED_GR_LOG_H */
diff --git a/gnuradio-core/src/lib/runtime/gr_log.i b/gnuradio-core/src/lib/runtime/gr_log.i
deleted file mode 100644
index 5175ef95f7..0000000000
--- a/gnuradio-core/src/lib/runtime/gr_log.i
+++ /dev/null
@@ -1,94 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2012 Free Software Foundation, Inc.
- * 
- * This file is part of GNU Radio
- * 
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- * 
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-/*******************************************************************************
-* Copyright 2011 Johns Hopkins University Applied Physics Lab
-* Author: Mark Plett
-* Description:
-*   SWIG interface generator file for gr_log module.  gr_log wraps log4cxx logging
-*   for gnuradio.
-*******************************************************************************/
-
-%feature("autodoc", "1");		// generate python docstrings
-
-%include "exception.i"
-%import "gnuradio.i"			// the common stuff
-
-%{
-#include "gnuradio_swig_bug_workaround.h"	// mandatory bug fix
-#include <stdexcept>
-%}
-
-//-----------------------------------
-
-#ifdef ENABLE_GR_LOG
-
-%{
-// The .h files
-#include <gr_log.h>
-#include <log4cxx/logger.h>
-#include <log4cxx/logmanager.h>
-%}
-
-namespace log4cxx{
-class LoggerPtr {
-public:
- ~LoggerPtr();
-};
-};
-void logger_load_config(const std::string &config_filename);
-void logger_set_level(log4cxx::LoggerPtr logger, const std::string &level);
-
-%rename(log) gr_log;
-
-class gr_log
-{
-private:
-  
-public:
-  //gr_log(std::string config_filename);
-  gr_log(std::string config_filename,int watchPeriodSec);
-  void set_level(std::string name,std::string level);
-  void get_level(std::string name,std::string &level);
-  void trace(std::string name,std::string msg);
-  void debug(std::string name,std::string msg);
-  void info(std::string name,std::string msg);
-  void warn(std::string name,std::string msg);
-  void error(std::string name,std::string msg);
-  void fatal(std::string name,std::string msg);
-  void errorIF(std::string name,bool cond,std::string msg);
-  void gr_assert(std::string name,bool cond,std::string msg);
-
-  static log4cxx::LoggerPtr getLogger(std::string name);
-
-  void set_log_level(log4cxx::LoggerPtr logger,std::string level);
-  void get_log_level(log4cxx::LoggerPtr logger,std::string &level);
-  void log_trace(log4cxx::LoggerPtr logger,std::string msg);
-  void log_debug(log4cxx::LoggerPtr logger,std::string msg);
-  void log_info(log4cxx::LoggerPtr logger,std::string msg);
-  void log_warn(log4cxx::LoggerPtr logger,std::string msg);
-  void log_error(log4cxx::LoggerPtr logger,std::string msg);
-  void log_fatal(log4cxx::LoggerPtr logger,std::string msg);
-  void log_errorIF(log4cxx::LoggerPtr logger,bool cond,std::string msg);
-  void log_assert(log4cxx::LoggerPtr logger,bool cond,std::string msg);
-};
-
-#endif /* ENABLE_GR_LOG */
diff --git a/gnuradio-core/src/lib/runtime/gr_logger.cc b/gnuradio-core/src/lib/runtime/gr_logger.cc
new file mode 100644
index 0000000000..e337920a33
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_logger.cc
@@ -0,0 +1,189 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2012 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ * 
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+/*******************************************************************************
+* Copyright 2011 Johns Hopkins University Applied Physics Lab
+* Author: Mark Plett 
+* Description:
+*   The gr_log module wraps the log4cxx library for logging in gnuradio.
+*******************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h" 
+#endif
+
+#include <gr_logger.h>
+#include <stdexcept>
+#include <algorithm>
+
+#ifdef ENABLE_GR_LOG
+#ifdef HAVE_LOG4CXX 
+
+bool gr_logger_configured(false);
+
+void
+logger_load_config(const std::string &config_filename)
+{
+  if(!gr_logger_configured) {
+    gr_logger_configured = true;
+    if(config_filename.size() > 0) {
+      if(config_filename.find(".xml") != std::string::npos) {
+        log4cxx::xml::DOMConfigurator::configure(config_filename);
+      }
+      else {
+        log4cxx::PropertyConfigurator::configure(config_filename);
+      }
+    }
+  }
+}
+
+void
+logger_load_config_and_watch(const std::string &config_filename,
+                             unsigned int watch_period)
+{
+  if(!gr_logger_configured) {
+    gr_logger_configured = true;
+    if(config_filename.size() > 0) {
+      if(config_filename.find(".xml") != std::string::npos) {
+        log4cxx::xml::DOMConfigurator::configureAndWatch(config_filename, watch_period);
+      }
+      else {
+        log4cxx::PropertyConfigurator::configureAndWatch(config_filename, watch_period);
+      }
+    }
+  }
+}
+
+void 
+logger_reset_config(void)
+{
+  log4cxx::LogManager::resetConfiguration();
+  gr_logger_configured=false;
+}
+
+void
+logger_set_level(gr_logger_ptr logger, const std::string &level)
+{
+  std::string nocase = level;
+  std::transform(level.begin(), level.end(), nocase.begin(), ::tolower);
+  
+  if(nocase == "off")
+    logger_set_level(logger, log4cxx::Level::getOff());
+  else if(nocase == "all")
+    logger_set_level(logger, log4cxx::Level::getAll());
+  else if(nocase == "trace")
+    logger_set_level(logger, log4cxx::Level::getTrace());
+  else if(nocase == "debug")
+    logger_set_level(logger, log4cxx::Level::getDebug());
+  else if(nocase == "info")
+    logger_set_level(logger, log4cxx::Level::getInfo());
+  else if(nocase == "warn")
+    logger_set_level(logger, log4cxx::Level::getWarn());
+  else if(nocase == "error")
+    logger_set_level(logger, log4cxx::Level::getError());
+  else if(nocase == "fatal")
+    logger_set_level(logger, log4cxx::Level::getFatal());
+  else
+    throw std::runtime_error("logger_set_level: Bad level type.\n");
+}
+
+void
+logger_set_level(gr_logger_ptr logger, log4cxx::LevelPtr level)
+{
+  logger->setLevel(level);
+}
+
+void 
+logger_get_level(gr_logger_ptr logger, std::string &level)
+{
+  log4cxx::LevelPtr levelPtr = logger->getLevel();
+  if(levelPtr == log4cxx::Level::getOff()) level = "off";
+  if(levelPtr == log4cxx::Level::getAll()) level = "all";
+  if(levelPtr == log4cxx::Level::getTrace()) level = "trace";
+  if(levelPtr == log4cxx::Level::getDebug()) level = "debug";
+  if(levelPtr == log4cxx::Level::getInfo()) level = "info";
+  if(levelPtr == log4cxx::Level::getWarn()) level = "warn";
+  if(levelPtr == log4cxx::Level::getError()) level = "error";
+  if(levelPtr == log4cxx::Level::getFatal()) level = "fatal";
+};
+
+void 
+logger_get_level(gr_logger_ptr logger, log4cxx::LevelPtr level)
+{
+  level = logger->getLevel();
+}
+
+void 
+logger_add_console_appender(gr_logger_ptr logger, std::string layout,
+                            std::string target)
+{
+  log4cxx::PatternLayout *playout =
+    new log4cxx::PatternLayout(layout);
+  log4cxx::ConsoleAppender *appender =
+    new log4cxx::ConsoleAppender(log4cxx::LayoutPtr(playout), target);
+  log4cxx::helpers::Pool p;
+  appender->activateOptions(p);
+  logger->addAppender(appender);
+}
+
+void
+logger_add_file_appender(gr_logger_ptr logger, std::string layout,
+                         std::string filename, bool append)
+{
+  log4cxx::PatternLayout *playout =
+    new log4cxx::PatternLayout(layout);
+  log4cxx::FileAppender *appender =
+    new log4cxx::FileAppender(log4cxx::LayoutPtr(playout), filename, append);
+  log4cxx::helpers::Pool p;
+  appender->activateOptions(p);
+  logger->addAppender(appender);
+}
+
+void 
+logger_add_rollingfile_appender(gr_logger_ptr logger, std::string layout,
+                                std::string filename, bool append,
+                                int bkup_index, std::string filesize)
+{
+  log4cxx::PatternLayout *playout =
+    new log4cxx::PatternLayout(layout);
+  log4cxx::RollingFileAppender *appender = 
+    new log4cxx::RollingFileAppender(log4cxx::LayoutPtr(playout), filename, append);
+  appender->setMaxBackupIndex(bkup_index);
+  appender->setMaxFileSize(filesize);
+  log4cxx::helpers::Pool p; 
+  appender->activateOptions(p);
+  logger->addAppender(appender);
+}
+
+void
+logger_get_logger_names(std::vector<std::string>& names)
+{
+  log4cxx::LoggerList list = log4cxx::LogManager::getCurrentLoggers();
+  log4cxx::LoggerList::iterator logger = list.begin();
+  names.clear();
+  for(; logger != list.end(); logger++) {
+    names.push_back((*logger)->getName());
+  }
+}
+
+#endif /* HAVE_LOG4CXX */
+#endif /* ENABLE_GR_LOGGER */
diff --git a/gnuradio-core/src/lib/runtime/gr_logger.h b/gnuradio-core/src/lib/runtime/gr_logger.h
new file mode 100644
index 0000000000..40684ec9d0
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_logger.h
@@ -0,0 +1,498 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2012 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ * 
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+/*******************************************************************************
+* Copyright 2011 Johns Hopkins University Applied Physics Lab
+* Author: Mark Plett
+* Description:
+*   The gr_logger module wraps the log4cxx library for logging in gnuradio
+*******************************************************************************/
+
+#ifndef INCLUDED_GR_LOGGER_H
+#define INCLUDED_GR_LOGGER_H
+
+/*!
+* \file gr_logger.h
+* \ingroup logging
+* \brief GNURADIO logging wrapper for log4cxx library (C++ port of log4j)
+*
+*/
+
+#include <gr_core_api.h>
+#include <assert.h>
+#include <iostream>
+
+#ifdef ENABLE_GR_LOG
+
+// We have three configurations... first logging to stdout/stderr
+#ifndef HAVE_LOG4CXX
+//#warning GR logging Enabled and using std::cout
+
+typedef std::string gr_logger_ptr;
+
+#define GR_LOG_DECLARE_LOGPTR(logger)
+#define GR_LOG_ASSIGN_LOGPTR(logger,name)
+#define GR_CONFIG_LOGGER(config)
+#define GR_CONFIG_AND_WATCH_LOGGER(config)
+#define GR_LOG_GETLOGGER(logger, name) 
+#define GR_SET_LEVEL(name, level)
+#define GR_LOG_SET_LEVEL(logger, level) 
+#define GR_GET_LEVEL(name, level)
+#define GR_LOG_GET_LEVEL(logger, level)
+#define GR_ADD_CONSOLE_APPENDER(logger,layout)
+#define GR_LOG_ADD_CONSOLE_APPENDER(logger,layout)
+#define GR_ADD_FILE_APPENDER(logger,layout,filename,append)
+#define GR_LOG_ADD_FILE_APPENDER(logger,layout,filename,append)
+#define GR_ADD_ROLLINGFILE_APPENDER(logger,layout,filename,append,bkup_index,filesize)
+#define GR_LOG_ADD_ROLLINGFILE_APPENDER(logger,layout,filename,append,bkup_index,filesize)
+#define GR_GET_LOGGER_NAMES(names)
+#define GR_RESET_CONFIGURATION()
+#define GR_TRACE(name, msg) std::cout<<"TRACE:"<<msg<<std::endl
+#define GR_DEBUG(name, msg) std::cout<<"DEBUG:"<<msg<<std::endl
+#define GR_INFO(name, msg) std::cout<<"INFO:"<<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_FATAL(name, msg) std::cerr<<"FATAL:"<<msg<<std::endl
+#define GR_ERRORIF(name, cond, msg) if((cond)) std::cerr<<"ERROR:"<<msg<<std::endl
+#define GR_ASSERT(name, cond, msg) std::cerr<<"ERROR:"<<msg<<std::endl; assert(cond)
+#define GR_LOG_SET_LEVEL(logger, level)
+#define GR_LOG_GET_LEVEL(logger, level)
+#define GR_LOG_TRACE(logger, msg) std::cout<<"TRACE:"<<msg<<std::endl
+#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_WARN(logger, msg) std::cerr<<"WARN:"<<msg<<std::endl
+#define GR_LOG_ERROR(logger, msg) std::cerr<<"ERROR:"<<msg<<std::endl
+#define GR_LOG_FATAL(logger, msg) std::cerr<<"FATAL:"<<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_LOG4CXX */
+// Second configuration...logging to log4cxx
+//#warning GR logging Enabled and using LOG4CXX
+
+#include <log4cxx/logger.h>
+#include <log4cxx/logmanager.h>
+#include <log4cxx/basicconfigurator.h>
+#include <log4cxx/xml/domconfigurator.h>
+#include <log4cxx/propertyconfigurator.h>
+#include <log4cxx/helpers/pool.h>
+#include <log4cxx/fileappender.h>
+#include <log4cxx/rollingfileappender.h>
+#include <log4cxx/consoleappender.h>
+#include <log4cxx/patternlayout.h>
+
+/*!
+ * \brief GR_LOG macros
+ * \ingroup logging
+ *
+ * These macros wrap the standard LOG4CXX_LEVEL macros.  The availablie macros
+ * are:
+ *  GR_LOG_TRACE
+ *  GR_LOG_DEBUG
+ *  GR_LOG_INFO
+ *  GR_LOG_WARN
+ *  GR_LOG_ERROR
+ *  GR_LOG_FATAL
+ */
+
+typedef log4cxx::LoggerPtr gr_logger_ptr;
+
+/* Macros for Programmatic Configuration */
+#define GR_LOG_DECLARE_LOGPTR(logger) \
+  gr_logger_ptr logger;
+
+#define GR_LOG_ASSIGN_LOGPTR(logger,name) \
+  logger = gr_logger::getLogger(name);
+
+#define GR_CONFIG_LOGGER(config)	\
+  logger_load_config(config)
+
+#define GR_CONFIG_AND_WATCH_LOGGER(config,period)	\
+  logger_load_config_and_watch(config,period)
+
+#define GR_LOG_GETLOGGER(logger, name) \
+  log4cxx::LoggerPtr logger = gr_logger::getLogger(name);
+
+#define GR_SET_LEVEL(name, level){ \
+  log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(name); \
+  logger_set_level(logger, level);}
+
+#define GR_LOG_SET_LEVEL(logger, level) \
+  logger_set_level(logger, level);
+
+#define GR_GET_LEVEL(name, level){ \
+  log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(name); \
+  logger_get_level(logger,level);}
+
+#define GR_LOG_GET_LEVEL(logger, level) \
+  logger_get_level(logger,level);
+
+#define GR_ADD_CONSOLE_APPENDER(name,layout,terget){d      \
+  gr_logger_ptr logger = log4cxx::Logger::getLogger(name); \
+  logger_add_console_appender(logger,layout, target);}
+
+#define GR_LOG_ADD_CONSOLE_APPENDER(logger,layout,target){      \
+  logger_add_console_appender(logger,layout,target);}
+
+#define GR_ADD_FILE_APPENDER(name,layout,filename,append){\
+  gr_logger_ptr logger = log4cxx::Logger::getLogger(name); \
+  logger_add_file_appender(logger,layout,filename,append);}
+
+#define GR_LOG_ADD_FILE_APPENDER(logger,layout,filename,append){\
+  logger_add_file_appender(logger,layout,filename,append);}
+
+#define GR_ADD_ROLLINGFILE_APPENDER(name,layout,filename,append,bkup_index,filesize){\
+  gr_logger_ptr logger = log4cxx::Logger::getLogger(name); \
+  logger_add_rollingfile_appender(logger,layout,filename,append,bkup_index,filesize);}
+
+#define GR_LOG_ADD_ROLLINGFILE_APPENDER(logger,layout,filename,append,bkup_index,filesize){\
+  logger_add_rollingfile_appender(logger,layout,filename,append,bkup_index,filesize);}
+
+#define GR_GET_LOGGER_NAMES(names){ \
+  logger_get_logger_names(names);}
+
+#define GR_RESET_CONFIGURATION(){ \
+  logger_reset_config();}
+
+/* Logger name referenced macros */
+#define GR_TRACE(name, msg) { \
+  log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(name); \
+  LOG4CXX_TRACE(logger, msg);}
+
+#define GR_DEBUG(name, msg) { \
+  log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(name); \
+  LOG4CXX_DEBUG(logger, msg);}
+
+#define GR_INFO(name, msg) { \
+  log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(name); \
+  LOG4CXX_INFO(logger, msg);}
+
+#define GR_WARN(name, msg) { \
+  log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(name); \
+  LOG4CXX_WARN(logger, msg);}
+
+#define GR_ERROR(name, msg) { \
+  log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(name); \
+  LOG4CXX_ERROR(logger, msg);}
+
+#define GR_FATAL(name, msg) { \
+  log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(name); \
+  LOG4CXX_FATAL(logger, msg);}
+
+#define GR_ERRORIF(name, cond, msg) { \
+  log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(name); \
+  LOG4CXX_ASSERT(logger, !(cond), msg);}
+
+#define GR_ASSERT(name, cond, msg) { \
+  log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(name); \
+  LOG4CXX_ASSERT(logger, (cond), msg); \
+  assert((cond));}
+
+/* LoggerPtr Referenced Macros */
+#define GR_LOG_TRACE(logger, msg) { \
+  LOG4CXX_TRACE(logger, msg);}
+
+#define GR_LOG_DEBUG(logger, msg) { \
+  LOG4CXX_DEBUG(logger, msg);}
+
+#define GR_LOG_INFO(logger, msg) { \
+  LOG4CXX_INFO(logger, msg);}
+
+#define GR_LOG_WARN(logger, msg) { \
+  LOG4CXX_WARN(logger, msg);}
+
+#define GR_LOG_ERROR(logger, msg) { \
+  LOG4CXX_ERROR(logger, msg);}
+
+#define GR_LOG_FATAL(logger, msg) { \
+  LOG4CXX_FATAL(logger, msg);}
+
+#define GR_LOG_ERRORIF(logger,cond, msg) { \
+  LOG4CXX_ASSERT(logger, !(cond), msg);}
+
+#define GR_LOG_ASSERT(logger, cond, msg) { \
+  LOG4CXX_ASSERT(logger, (cond), msg); \
+  assert((cond));}
+
+/*!
+ * \brief Load logger's configuration file.
+ *
+ * Initialize the GNU Radio logger by loading the configuration file
+ * \p config_filename.
+ *
+ * \param config_filename The configuration file. Set to "" for the
+ *        basic logger that outputs to the console.
+ */
+GR_CORE_API void logger_load_config(const std::string &config_filename="");
+
+
+GR_CORE_API void logger_load_config_and_watch(const std::string &config_filename,
+                                              unsigned int watch_period);
+
+GR_CORE_API void logger_reset_config(void);
+
+/*!
+ * \brief Set the logger's output level.
+ *
+ * Sets the level of the logger. This takes a string that is
+ * translated to the standard levels and can be (case insensitive):
+ *
+ * \li off
+ * \li all
+ * \li trace
+ * \li debug
+ * \li info
+ * \li warn
+ * \li error
+ * \li fatal
+ *
+ * \param logger the logger to set the level of.
+ * \param level  string to set the level to.
+ */
+GR_CORE_API void logger_set_level(gr_logger_ptr logger, const std::string &level);
+
+/*!
+ * \brief Set the logger's output level.
+ *
+ * Sets the level of the logger. This takes the actual Log4cxx::Level
+ * data type, which can be:
+ *
+ * \li log4cxx::Level::getOff()
+ * \li log4cxx::Level::getAll()
+ * \li log4cxx::Level::getTrace()
+ * \li log4cxx::Level::getDebug()
+ * \li log4cxx::Level::getInfo()
+ * \li log4cxx::Level::getWarn()
+ * \li log4cxx::Level::getError()
+ * \li log4cxx::Level::getFatal()
+ *
+ * \param logger the logger to set the level of.
+ * \param level  new logger level of type Log4cxx::Level
+ */
+GR_CORE_API void logger_set_level(gr_logger_ptr logger, log4cxx::LevelPtr level);
+
+
+/*!
+ * \brief Get the logger's output level.
+ *
+ * Gets the level of the logger. This returns a string that
+ * corresponds to the standard levels and can be (case insensitive):
+ *
+ * \li off
+ * \li all
+ * \li trace
+ * \li debug
+ * \li info
+ * \li warn
+ * \li error
+ * \li fatal
+ *
+ * \param logger the logger to get the level of.
+ * \param level  string to get the level into.
+ */
+GR_CORE_API void logger_get_level(gr_logger_ptr logger, std::string &level);
+
+/*!
+ * \brief Get the logger's output level.
+ *
+ * Gets the level of the logger. This returns the actual Log4cxx::Level
+ * data type, which can be:
+ *
+ * \li log4cxx::Level::getOff()
+ * \li log4cxx::Level::getAll()
+ * \li log4cxx::Level::getTrace()
+ * \li log4cxx::Level::getDebug()
+ * \li log4cxx::Level::getInfo()
+ * \li log4cxx::Level::getWarn()
+ * \li log4cxx::Level::getError()
+ * \li log4cxx::Level::getFatal()
+ *
+ * \param logger the logger to get the level of.
+ */
+GR_CORE_API void logger_get_level(gr_logger_ptr logger, log4cxx::LevelPtr level);
+
+
+GR_CORE_API void logger_add_console_appender(gr_logger_ptr logger, std::string layout,
+                                             std::string target);
+
+GR_CORE_API void logger_add_file_appender(gr_logger_ptr logger, std::string layout,
+                                          std::string filename, bool append);
+
+GR_CORE_API void logger_add_rollingfile_appender(gr_logger_ptr logger, std::string layout,
+                                                 std::string filename, bool append,
+                                                 int bkup_index, std::string filesize);
+
+GR_CORE_API void logger_get_logger_names(std::vector<std::string>& names);
+
+/*!
+ * \brief instantiate (configure) logger.
+ * \ingroup logging
+ *
+ */
+class gr_logger
+{
+ public:
+  /*!
+   * \brief contructor take log configuration file and configures loggers.
+   */
+  gr_logger(std::string config_filename)
+  {
+    // Load configuration file
+    logger_load_config(config_filename);
+  };
+
+  /*!
+   * \brief contructor take log configuration file and watchtime and configures
+   */
+  gr_logger(std::string config_filename, int watchPeriodSec)
+  {
+    // Load configuration file
+    if(config_filename.find(".xml")!=std::string::npos) {
+      log4cxx::xml::DOMConfigurator::configureAndWatch(config_filename, watchPeriodSec);
+    }
+    else {
+      log4cxx::PropertyConfigurator::configureAndWatch(config_filename, watchPeriodSec);
+    }
+  };
+
+  static log4cxx::LoggerPtr getLogger(std::string name)
+  {
+    if(log4cxx::LogManager::exists(name)) {
+      log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(name);
+      return logger;
+    }
+    else {
+      log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(name);
+      logger->setLevel(log4cxx::Level::getOff());
+      return logger;
+    };
+  };
+
+  // Wrappers for logging macros
+  /*! \brief inline function, wrapper to set the logger level */
+  void set_level(std::string name,std::string level){GR_SET_LEVEL(name,level);}
+  
+  /*! \brief inline function, wrapper to get the logger level */
+  void get_level(std::string name,std::string &level){GR_GET_LEVEL(name,level);}
+
+  /*! \brief inline function, wrapper for LOG4CXX_TRACE for TRACE message */
+  void trace(std::string name,std::string msg){GR_TRACE(name,msg);};
+
+  /*! \brief inline function, wrapper for LOG4CXX_DEBUG for DEBUG message */
+  void debug(std::string name,std::string msg){GR_DEBUG(name,msg);};
+
+  /*! \brief inline function, wrapper for LOG4CXX_INFO for INFO message */
+  void info(std::string name,std::string msg){GR_INFO(name,msg);};
+
+  /*! \brief inline function, wrapper for LOG4CXX_WARN for WARN message */
+  void warn(std::string name,std::string msg){GR_WARN(name,msg);};
+
+  /*! \brief inline function, wrapper for LOG4CXX_ERROR for ERROR message */
+  void error(std::string name,std::string msg){GR_ERROR(name,msg);};
+
+  /*! \brief inline function, wrapper for LOG4CXX_FATAL for FATAL message */
+  void fatal(std::string name,std::string msg){GR_FATAL(name,msg);};
+
+  /*! \brief inline function, wrapper for LOG4CXX_ASSERT for conditional ERROR message */
+  void errorIF(std::string name,bool cond,std::string msg){GR_ERRORIF(name,cond,msg);};
+
+  /*! \brief inline function, wrapper for LOG4CXX_ASSERT for conditional ERROR message */
+  void gr_assert(std::string name,bool cond,std::string msg){GR_ASSERT(name,cond,msg);};
+
+  // Wrappers for Logger Pointer referenced functions
+  /*! \brief inline function, wrapper to set the logger level */
+  void set_log_level(log4cxx::LoggerPtr logger,std::string level){GR_LOG_SET_LEVEL(logger,level);}
+
+  /*! \brief inline function, wrapper to get the logger level */
+  void get_log_level(log4cxx::LoggerPtr logger,std::string &level){GR_LOG_GET_LEVEL(logger,level);}
+
+  /*! \brief inline function, wrapper for LOG4CXX_TRACE for TRACE message */
+  void log_trace(log4cxx::LoggerPtr logger,std::string msg){GR_LOG_TRACE(logger,msg);};
+
+  /*! \brief inline function, wrapper for LOG4CXX_DEBUG for DEBUG message */
+  void log_debug(log4cxx::LoggerPtr logger,std::string msg){GR_LOG_DEBUG(logger,msg);};
+
+  /*! \brief inline function, wrapper for LOG4CXX_INFO for INFO message */
+  void log_info(log4cxx::LoggerPtr logger,std::string msg){GR_LOG_INFO(logger,msg);};
+
+  /*! \brief inline function, wrapper for LOG4CXX_WARN for WARN message */
+  void log_warn(log4cxx::LoggerPtr logger,std::string msg){GR_LOG_WARN(logger,msg);};
+
+  /*! \brief inline function, wrapper for LOG4CXX_ERROR for ERROR message */
+  void log_error(log4cxx::LoggerPtr logger,std::string msg){GR_LOG_ERROR(logger,msg);};
+
+  /*! \brief inline function, wrapper for LOG4CXX_FATAL for FATAL message */
+  void log_fatal(log4cxx::LoggerPtr logger,std::string msg){GR_LOG_FATAL(logger,msg);};
+
+  /*! \brief inline function, wrapper for LOG4CXX_ASSERT for conditional ERROR message */
+  void log_errorIF(log4cxx::LoggerPtr logger,bool cond,std::string msg){GR_LOG_ERRORIF(logger,cond,msg);};
+
+  /*! \brief inline function, wrapper for LOG4CXX_ASSERT for conditional ERROR message */
+  void log_assert(log4cxx::LoggerPtr logger,bool cond,std::string msg){GR_LOG_ASSERT(logger,cond,msg);};
+};
+
+
+#endif /* HAVE_LOG4CXX */
+
+// If Logger disable do nothing
+#else /* ENABLE_GR_LOG */
+
+typedef void* gr_logger_ptr;
+
+#define GR_LOG_DECLARE_LOGPTR(logger)
+#define GR_LOG_ASSIGN_LOGPTR(logger,name)
+#define GR_CONFIG_LOGGER(config)
+#define GR_CONFIG_AND_WATCH_LOGGER(config)
+#define GR_LOG_GETLOGGER(logger, name) 
+#define GR_SET_LEVEL(name, level)
+#define GR_LOG_SET_LEVEL(logger, level) 
+#define GR_GET_LEVEL(name, level)
+#define GR_LOG_GET_LEVEL(logger, level)
+#define GR_ADD_CONSOLE_APPENDER(logger,layout)
+#define GR_LOG_ADD_CONSOLE_APPENDER(logger,layout)
+#define GR_ADD_FILE_APPENDER(logger,layout,filename,append)
+#define GR_LOG_ADD_FILE_APPENDER(logger,layout)
+#define GR_ADD_ROLLINGFILE_APPENDER(logger,layout,filename,append,bkup_index,filesize)
+#define GR_LOG_ADD_ROLLINGFILE_APPENDER(logger,layout)
+#define GR_GET_LOGGER_NAMES(names)
+#define GR_RESET_CONFIGURATION()
+#define GR_TRACE(name, msg)
+#define GR_DEBUG(name, msg)
+#define GR_INFO(name, msg)
+#define GR_WARN(name, msg) 
+#define GR_ERROR(name, msg) 
+#define GR_FATAL(name, msg) 
+#define GR_ERRORIF(name, cond, msg)
+#define GR_ASSERT(name, cond, msg)
+#define GR_LOG_SET_LEVEL(logger, level)
+#define GR_LOG_GET_LEVEL(logger, level)
+#define GR_LOG_TRACE(logger, msg)
+#define GR_LOG_DEBUG(logger, msg)
+#define GR_LOG_INFO(logger, msg) 
+#define GR_LOG_WARN(logger, msg) 
+#define GR_LOG_ERROR(logger, msg) 
+#define GR_LOG_FATAL(logger, msg) 
+#define GR_LOG_ERRORIF(logger, cond, msg)
+#define GR_LOG_ASSERT(logger, cond, msg)
+
+#endif /* ENABLE_GR_LOG */
+#endif /* INCLUDED_GR_LOGGER_H */
diff --git a/gnuradio-core/src/lib/runtime/gr_logger.i b/gnuradio-core/src/lib/runtime/gr_logger.i
new file mode 100644
index 0000000000..1eedf3d60d
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_logger.i
@@ -0,0 +1,96 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2012 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ * 
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+/*******************************************************************************
+* Copyright 2011 Johns Hopkins University Applied Physics Lab
+* Author: Mark Plett
+* Description:
+*   SWIG interface generator file for gr_logger module.  gr_logger wraps log4cxx logging
+*   for gnuradio.
+*******************************************************************************/
+
+%feature("autodoc", "1");		// generate python docstrings
+
+%include "exception.i"
+%import "gnuradio.i"			// the common stuff
+
+%{
+#include "gnuradio_swig_bug_workaround.h"	// mandatory bug fix
+#include <stdexcept>
+%}
+
+//-----------------------------------
+
+#ifdef ENABLE_GR_LOG
+#ifdef HAVE_LOG4CXX
+
+%{
+// The .h files
+#include <gr_logger.h>
+#include <log4cxx/logger.h>
+#include <log4cxx/logmanager.h>
+%}
+
+namespace log4cxx{
+class LoggerPtr {
+public:
+ ~LoggerPtr();
+};
+};
+void logger_load_config(const std::string &config_filename);
+void logger_set_level(log4cxx::LoggerPtr logger, const std::string &level);
+
+%rename(log) gr_logger;
+
+class gr_logger
+{
+private:
+  
+public:
+  //gr_logger(std::string config_filename);
+  gr_logger(std::string config_filename,int watchPeriodSec);
+  void set_level(std::string name,std::string level);
+  void get_level(std::string name,std::string &level);
+  void trace(std::string name,std::string msg);
+  void debug(std::string name,std::string msg);
+  void info(std::string name,std::string msg);
+  void warn(std::string name,std::string msg);
+  void error(std::string name,std::string msg);
+  void fatal(std::string name,std::string msg);
+  void errorIF(std::string name,bool cond,std::string msg);
+  void gr_assert(std::string name,bool cond,std::string msg);
+
+  static log4cxx::LoggerPtr getLogger(std::string name);
+
+  void set_log_level(log4cxx::LoggerPtr logger,std::string level);
+  void get_log_level(log4cxx::LoggerPtr logger,std::string &level);
+  void log_trace(log4cxx::LoggerPtr logger,std::string msg);
+  void log_debug(log4cxx::LoggerPtr logger,std::string msg);
+  void log_info(log4cxx::LoggerPtr logger,std::string msg);
+  void log_warn(log4cxx::LoggerPtr logger,std::string msg);
+  void log_error(log4cxx::LoggerPtr logger,std::string msg);
+  void log_fatal(log4cxx::LoggerPtr logger,std::string msg);
+  void log_errorIF(log4cxx::LoggerPtr logger,bool cond,std::string msg);
+  void log_assert(log4cxx::LoggerPtr logger,bool cond,std::string msg);
+};
+
+#endif /* HAVE_LOG4CXX */
+#endif /* ENABLE_GR_LOG */
diff --git a/gnuradio-core/src/lib/runtime/qa_gr_log.cc b/gnuradio-core/src/lib/runtime/qa_gr_log.cc
deleted file mode 100644
index a973408028..0000000000
--- a/gnuradio-core/src/lib/runtime/qa_gr_log.cc
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2012 Free Software Foundation, Inc.
- * 
- * This file is part of GNU Radio
- * 
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- * 
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-/*
- * This class gathers together all the test cases for the example
- * directory into a single test suite.  As you create new test cases,
- * add them here.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <qa_gr_log.h>
-#include <gr_log.h>
-
-void
-qa_gr_log::t1()
-{
-#ifdef ENABLE_GR_LOG
-  // This doesn't really test anything, more just
-  // making sure nothing's gone horribly wrong.
-  GR_LOG_GETLOGGER(LOG,"errLoggerRoot");
-  GR_LOG_TRACE(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");
-  CPPUNIT_ASSERT(true);
-#endif
-}
diff --git a/gnuradio-core/src/lib/runtime/qa_gr_log.h b/gnuradio-core/src/lib/runtime/qa_gr_log.h
deleted file mode 100644
index 75e96d2e7a..0000000000
--- a/gnuradio-core/src/lib/runtime/qa_gr_log.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2012 Free Software Foundation, Inc.
- * 
- * This file is part of GNU Radio
- * 
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Example Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- * 
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Example Public License for more details.
- * 
- * You should have received a copy of the GNU Example Public License
- * along with GNU Radio; see the file COPYING.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_QA_GR_LOG_H
-#define INCLUDED_QA_GR_LOG_H
-
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/TestSuite.h>
-
-//! collect all the tests for the example directory
-
-class qa_gr_log : public CppUnit::TestCase {
- public:
-  CPPUNIT_TEST_SUITE(qa_gr_log); 
-  CPPUNIT_TEST(t1);
-  CPPUNIT_TEST_SUITE_END();
-
- private:
-  void t1();
- 
-};
-
-#endif /* INCLUDED_QA_GR_LOG_H */
diff --git a/gnuradio-core/src/lib/runtime/qa_gr_logger.cc b/gnuradio-core/src/lib/runtime/qa_gr_logger.cc
new file mode 100644
index 0000000000..3d21c1f305
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/qa_gr_logger.cc
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2012 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ * 
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+/*
+ * This class gathers together all the test cases for the example
+ * directory into a single test suite.  As you create new test cases,
+ * add them here.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <qa_gr_logger.h>
+#include <gr_logger.h>
+
+void
+qa_gr_logger::t1()
+{
+#ifdef ENABLE_GR_LOG
+  // This doesn't really test anything, more just
+  // making sure nothing's gone horribly wrong.
+  GR_LOG_GETLOGGER(LOG,"errLoggerRoot");
+  GR_LOG_TRACE(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");
+  CPPUNIT_ASSERT(true);
+#endif
+}
diff --git a/gnuradio-core/src/lib/runtime/qa_gr_logger.h b/gnuradio-core/src/lib/runtime/qa_gr_logger.h
new file mode 100644
index 0000000000..b0d3711523
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/qa_gr_logger.h
@@ -0,0 +1,42 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2012 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Example Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ * 
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Example Public License for more details.
+ * 
+ * You should have received a copy of the GNU Example Public License
+ * along with GNU Radio; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_QA_GR_LOG_H
+#define INCLUDED_QA_GR_LOG_H
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestSuite.h>
+
+//! collect all the tests for the example directory
+
+class qa_gr_logger : public CppUnit::TestCase {
+ public:
+  CPPUNIT_TEST_SUITE(qa_gr_logger); 
+  CPPUNIT_TEST(t1);
+  CPPUNIT_TEST_SUITE_END();
+
+ private:
+  void t1();
+ 
+};
+
+#endif /* INCLUDED_QA_GR_LOG_H */
diff --git a/gnuradio-core/src/lib/runtime/qa_runtime.cc b/gnuradio-core/src/lib/runtime/qa_runtime.cc
index 90b345c04f..62c95ef5c4 100644
--- a/gnuradio-core/src/lib/runtime/qa_runtime.cc
+++ b/gnuradio-core/src/lib/runtime/qa_runtime.cc
@@ -34,7 +34,7 @@
 #include <qa_gr_io_signature.h>
 #include <qa_gr_block.h>
 #include <qa_gr_flowgraph.h>
-#include <qa_gr_log.h>
+#include <qa_gr_logger.h>
 #include <qa_gr_top_block.h>
 #include <qa_gr_hier_block2.h>
 #include <qa_gr_hier_block2_derived.h>
@@ -51,7 +51,7 @@ qa_runtime::suite ()
   s->addTest (qa_gr_io_signature::suite ());
   s->addTest (qa_gr_block::suite ());
   s->addTest (qa_gr_flowgraph::suite ());
-  s->addTest (qa_gr_log::suite ());
+  s->addTest (qa_gr_logger::suite ());
   s->addTest (qa_gr_top_block::suite ());
   s->addTest (qa_gr_hier_block2::suite ());
   s->addTest (qa_gr_hier_block2_derived::suite ());
diff --git a/gnuradio-core/src/lib/runtime/runtime.i b/gnuradio-core/src/lib/runtime/runtime.i
index 9e0e378290..8902c6103f 100644
--- a/gnuradio-core/src/lib/runtime/runtime.i
+++ b/gnuradio-core/src/lib/runtime/runtime.i
@@ -40,7 +40,7 @@
 #include <gr_sync_decimator.h>
 #include <gr_sync_interpolator.h>
 #include <gr_top_block.h>
-#include <gr_log.h>
+#include <gr_logger.h>
 %}
 
 %constant int sizeof_char 	= sizeof(char);
@@ -68,4 +68,4 @@
 %include <gr_sync_decimator.i>
 %include <gr_sync_interpolator.i>
 %include <gr_top_block.i>
-%include <gr_log.i>
+%include <gr_logger.i>
diff --git a/gr-filter/lib/CMakeLists.txt b/gr-filter/lib/CMakeLists.txt
index 626f5521f2..1aa1387893 100644
--- a/gr-filter/lib/CMakeLists.txt
+++ b/gr-filter/lib/CMakeLists.txt
@@ -97,10 +97,14 @@ include_directories(
     ${GNURADIO_CORE_INCLUDE_DIRS}
     ${VOLK_INCLUDE_DIRS}
     ${GRUEL_INCLUDE_DIRS}
+    ${LOG4CXX_INCLUDE_DIRS}
     ${Boost_INCLUDE_DIRS}
 )
 
-link_directories(${Boost_LIBRARY_DIRS})
+link_directories(
+  ${Boost_LIBRARY_DIRS}
+  ${LOG4CXX_LIBRARIES}
+)
 
 ########################################################################
 # Setup library
-- 
cgit v1.2.3