summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt3
-rw-r--r--cmake/Modules/FindLog4cxx.cmake28
-rw-r--r--cmake/Modules/GrMiscUtils.cmake32
-rw-r--r--docs/doxygen/other/extra_pages.dox2
-rw-r--r--docs/doxygen/other/main_page.dox1
-rw-r--r--gnuradio-core/CMakeLists.txt16
-rw-r--r--gnuradio-core/gnuradio-core.conf.in (renamed from gnuradio-core/gnuradio-core.conf)6
-rw-r--r--gnuradio-core/gr_log_default.xml64
-rw-r--r--gnuradio-core/src/lib/CMakeLists.txt16
-rw-r--r--gnuradio-core/src/lib/filter/gr_fir_sysconfig_x86.cc105
-rw-r--r--gnuradio-core/src/lib/runtime/CMakeLists.txt5
-rw-r--r--gnuradio-core/src/lib/runtime/gr_log.cc112
-rw-r--r--gnuradio-core/src/lib/runtime/gr_log.h380
-rw-r--r--gnuradio-core/src/lib/runtime/gr_log.i94
-rw-r--r--gnuradio-core/src/lib/runtime/qa_gr_log.cc51
-rw-r--r--gnuradio-core/src/lib/runtime/qa_gr_log.h42
-rw-r--r--gnuradio-core/src/lib/runtime/qa_runtime.cc2
-rw-r--r--gnuradio-core/src/lib/runtime/runtime.i2
-rw-r--r--gnuradio-core/src/lib/swig/CMakeLists.txt12
-rw-r--r--gnuradio-core/src/tests/CMakeLists.txt3
-rw-r--r--gr-atsc/src/lib/CMakeLists.txt4
-rw-r--r--gr-audio/lib/CMakeLists.txt5
-rw-r--r--gr-comedi/src/CMakeLists.txt4
-rw-r--r--gr-digital/lib/CMakeLists.txt4
-rw-r--r--gr-fcd/lib/CMakeLists.txt5
-rw-r--r--gr-howto-write-a-block/CMakeLists.txt6
-rw-r--r--gr-howto-write-a-block/cmake/Modules/FindLog4cxx.cmake28
-rw-r--r--gr-howto-write-a-block/cmake/Modules/GrMiscUtils.cmake32
-rw-r--r--gr-howto-write-a-block/lib/CMakeLists.txt6
-rw-r--r--gr-noaa/lib/CMakeLists.txt4
-rw-r--r--gr-pager/lib/CMakeLists.txt4
-rw-r--r--gr-qtgui/lib/CMakeLists.txt3
-rw-r--r--gr-shd/lib/CMakeLists.txt4
-rw-r--r--gr-trellis/src/lib/CMakeLists.txt4
-rw-r--r--gr-uhd/lib/CMakeLists.txt4
-rw-r--r--gr-video-sdl/src/CMakeLists.txt2
-rw-r--r--gr-vocoder/lib/CMakeLists.txt4
-rw-r--r--gr-wavelet/lib/CMakeLists.txt4
38 files changed, 1069 insertions, 34 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b81d76ce84..f0e2ce5a45 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -226,6 +226,9 @@ CPACK_COMPONENT("volk_devel"
add_subdirectory(volk)
endif(ENABLE_VOLK)
+# Handle gr_log enable/disable
+GR_LOGGING()
+
########################################################################
# Distribute the README file
########################################################################
diff --git a/cmake/Modules/FindLog4cxx.cmake b/cmake/Modules/FindLog4cxx.cmake
new file mode 100644
index 0000000000..b1e4f6f1f7
--- /dev/null
+++ b/cmake/Modules/FindLog4cxx.cmake
@@ -0,0 +1,28 @@
+# CMake module to find LOG4CXX library
+
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(PC_LOG4CXX liblog4cxx)
+
+FIND_PATH(
+ LOG4CXX_INCLUDE_DIRS
+ NAMES log4cxx/log4cxx.h
+ HINTS $ENV{LOG4CXX_DIR}/include
+ ${PC_LOG4CXX_INCLUDE_DIRS}
+ PATHS /usr/local/include
+ /usr/include
+)
+
+FIND_LIBRARY(
+ LOG4CXX_LIBRARIES
+ NAMES log4cxx
+ HINTS $ENV{LOG4CXX_DIR}/lib
+ ${PC_LOG4CXX_LIBRARIES}
+ PATHS /usr/local/lib
+ /usr/local/lib64
+ /usr/lib
+ /usr/lib64
+)
+
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(LOG4CXX DEFAULT_MSG LOG4CXX_LIBRARIES LOG4CXX_INCLUDE_DIRS)
+MARK_AS_ADVANCED(LOG4CXX_LIBRARIES LOG4CXX_INCLUDE_DIRS)
diff --git a/cmake/Modules/GrMiscUtils.cmake b/cmake/Modules/GrMiscUtils.cmake
index 3e80846d62..088b4e0af1 100644
--- a/cmake/Modules/GrMiscUtils.cmake
+++ b/cmake/Modules/GrMiscUtils.cmake
@@ -209,6 +209,38 @@ function(GR_GEN_TARGET_DEPS name var)
endif()
endfunction(GR_GEN_TARGET_DEPS)
+########################################################################
+# 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}.")
+
+ SET(ENABLE_GR_LOG ${ENABLE_GR_LOG} CACHE INTERNAL "" FORCE)
+
+ 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)
########################################################################
# Run GRCC to compile .grc files into .py files.
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/docs/doxygen/other/main_page.dox b/docs/doxygen/other/main_page.dox
index e7d4685f75..8895cd552d 100644
--- a/docs/doxygen/other/main_page.dox
+++ b/docs/doxygen/other/main_page.dox
@@ -39,6 +39,7 @@ More details on packages in GNU Radio:
\li \ref page_vocoder
More details on GNU Radio concepts:
+\li \ref page_logger
\li \ref page_pmt
\li \ref page_msg_passing
\li \ref page_metadata
diff --git a/gnuradio-core/CMakeLists.txt b/gnuradio-core/CMakeLists.txt
index b277103547..49484dfecc 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_PREFSDIR}
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.in
index 70eb00236c..6ddc56df27 100644
--- a/gnuradio-core/gnuradio-core.conf
+++ b/gnuradio-core/gnuradio-core.conf.in
@@ -3,8 +3,12 @@
# ~/.gnuradio/config.conf
[DEFAULT]
-
verbose = False
+[LOG]
+log_config = @CMAKE_INSTALL_PREFIX@/etc/gnuradio/gr_log_default.xml
+log_level = all
+debug_level = DEBUG
+
[PerfCounters]
on = False
diff --git a/gnuradio-core/gr_log_default.xml b/gnuradio-core/gr_log_default.xml
new file mode 100644
index 0000000000..4260c0e12f
--- /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="grlog :%-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/CMakeLists.txt b/gnuradio-core/src/lib/CMakeLists.txt
index 89a1bad88b..08ee195ee2 100644
--- a/gnuradio-core/src/lib/CMakeLists.txt
+++ b/gnuradio-core/src/lib/CMakeLists.txt
@@ -54,13 +54,25 @@ link_directories(
${FFTW3F_LIBRARY_DIRS}
)
+include_directories(${LOG4CXX_INCLUDE_DIRS})
+link_directories(${LOG4CXX_LIBRARY_DIRS})
+
########################################################################
# Setup library
########################################################################
+
+# Only use if log4cxx is installed
+# Define ENABLE_GR_LOG so .h and .cc files can turn actual
+# logging and insert dummy functions.
+#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)
@@ -103,4 +115,8 @@ link_directories(${CPPUNIT_LIBRARY_DIRS})
add_library(test-gnuradio-core SHARED ${test_gnuradio_core_sources})
target_link_libraries(test-gnuradio-core gnuradio-core ${CPPUNIT_LIBRARIES} ${Boost_LIBRARIES})
+if(LOG4CXX_FOUND)
+ target_link_libraries(test-gnuradio-core gnuradio-core ${LOG4CXX_LIBRARIES})
+endif(LOG4CXX_FOUND)
+
endif(ENABLE_TESTING)
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..a218015154 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,15 @@ 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){
- 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 +193,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 +211,15 @@ 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){
- 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 +227,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 +245,15 @@ 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) {
- 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 +261,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 +269,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 +287,15 @@ 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) {
- 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 +303,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 +321,15 @@ 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) {
- 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 +337,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 +356,32 @@ 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", "");
+ 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 ()){
- 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 +390,15 @@ 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){
- 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 +406,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 +414,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 70938a0f17..1f8156edd1 100644
--- a/gnuradio-core/src/lib/runtime/CMakeLists.txt
+++ b/gnuradio-core/src/lib/runtime/CMakeLists.txt
@@ -62,6 +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_message.cc
${CMAKE_CURRENT_SOURCE_DIR}/gr_msg_accepter.cc
${CMAKE_CURRENT_SOURCE_DIR}/gr_msg_handler.cc
@@ -105,6 +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
)
########################################################################
@@ -126,6 +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_message.h
${CMAKE_CURRENT_SOURCE_DIR}/gr_msg_accepter.h
${CMAKE_CURRENT_SOURCE_DIR}/gr_msg_handler.h
@@ -170,6 +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_message.i
${CMAKE_CURRENT_SOURCE_DIR}/gr_msg_handler.i
${CMAKE_CURRENT_SOURCE_DIR}/gr_msg_queue.i
@@ -184,4 +188,5 @@ install(FILES
DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig
COMPONENT "core_swig"
)
+
endif(ENABLE_PYTHON)
diff --git a/gnuradio-core/src/lib/runtime/gr_log.cc b/gnuradio-core/src/lib/runtime/gr_log.cc
new file mode 100644
index 0000000000..371878d7f4
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_log.cc
@@ -0,0 +1,112 @@
+/* -*- 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
new file mode 100644
index 0000000000..4a0449b203
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_log.h
@@ -0,0 +1,380 @@
+/* -*- 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
new file mode 100644
index 0000000000..5175ef95f7
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_log.i
@@ -0,0 +1,94 @@
+/* -*- 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/qa_gr_log.cc b/gnuradio-core/src/lib/runtime/qa_gr_log.cc
new file mode 100644
index 0000000000..a973408028
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/qa_gr_log.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_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
new file mode 100644
index 0000000000..75e96d2e7a
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/qa_gr_log.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_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_runtime.cc b/gnuradio-core/src/lib/runtime/qa_runtime.cc
index 5e62c79915..90b345c04f 100644
--- a/gnuradio-core/src/lib/runtime/qa_runtime.cc
+++ b/gnuradio-core/src/lib/runtime/qa_runtime.cc
@@ -34,6 +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_top_block.h>
#include <qa_gr_hier_block2.h>
#include <qa_gr_hier_block2_derived.h>
@@ -50,6 +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_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 8e35df8342..9e0e378290 100644
--- a/gnuradio-core/src/lib/runtime/runtime.i
+++ b/gnuradio-core/src/lib/runtime/runtime.i
@@ -40,6 +40,7 @@
#include <gr_sync_decimator.h>
#include <gr_sync_interpolator.h>
#include <gr_top_block.h>
+#include <gr_log.h>
%}
%constant int sizeof_char = sizeof(char);
@@ -67,3 +68,4 @@
%include <gr_sync_decimator.i>
%include <gr_sync_interpolator.i>
%include <gr_top_block.i>
+%include <gr_log.i>
diff --git a/gnuradio-core/src/lib/swig/CMakeLists.txt b/gnuradio-core/src/lib/swig/CMakeLists.txt
index d8a64cc0f6..de42cf2a49 100644
--- a/gnuradio-core/src/lib/swig/CMakeLists.txt
+++ b/gnuradio-core/src/lib/swig/CMakeLists.txt
@@ -25,9 +25,19 @@ set(GR_SWIG_INCLUDE_DIRS
${CMAKE_CURRENT_BINARY_DIR}
${GNURADIO_CORE_SWIG_INCLUDE_DIRS}
${GRUEL_INCLUDE_DIRS}
+ ${LOG4CXX_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
)
-set(GR_SWIG_LIBRARIES gnuradio-core)
+set(GR_SWIG_LIBRARIES
+ gnuradio-core
+ ${LOG4CXX_LIBRARIES}
+)
+
+# Only use if log4cxx is installed
+# Define ENABLE_GR_LOG for the .i file to ignore it.
+if(ENABLE_GR_LOG)
+ SET(GR_SWIG_FLAGS "-DENABLE_GR_LOG")
+endif(ENABLE_GR_LOG)
link_directories(${Boost_LIBRARY_DIRS})
diff --git a/gnuradio-core/src/tests/CMakeLists.txt b/gnuradio-core/src/tests/CMakeLists.txt
index dbd52f05c7..f09c0bbe8f 100644
--- a/gnuradio-core/src/tests/CMakeLists.txt
+++ b/gnuradio-core/src/tests/CMakeLists.txt
@@ -36,6 +36,9 @@ link_directories(
${CPPUNIT_LIBRARY_DIRS}
)
+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 3d2b84a03c..50c7cbc6ea 100644
--- a/gr-atsc/src/lib/CMakeLists.txt
+++ b/gr-atsc/src/lib/CMakeLists.txt
@@ -30,6 +30,9 @@ include_directories(
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
@@ -98,6 +101,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 f39264d5d2..ff561c7a71 100644
--- a/gr-audio/lib/CMakeLists.txt
+++ b/gr-audio/lib/CMakeLists.txt
@@ -30,7 +30,10 @@ include_directories(
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 1d9dac2c48..116f561394 100644
--- a/gr-comedi/src/CMakeLists.txt
+++ b/gr-comedi/src/CMakeLists.txt
@@ -33,6 +33,9 @@ link_directories(
${COMEDI_LIBRARY_DIRS}
)
+include_directories(${LOG4CXX_INCLUDE_DIRS})
+link_directories(${LOG4CXX_LIBRARY_DIRS})
+
########################################################################
# Setup library
########################################################################
@@ -46,6 +49,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 7ac16602c7..c20f72521e 100644
--- a/gr-digital/lib/CMakeLists.txt
+++ b/gr-digital/lib/CMakeLists.txt
@@ -26,10 +26,12 @@ include_directories(
${GR_ANALOG_INCLUDE_DIRS}
${GNURADIO_CORE_INCLUDE_DIRS}
${GRUEL_INCLUDE_DIRS}
+ ${LOG4CXX_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
)
link_directories(${Boost_LIBRARY_DIRS})
+link_directories(${LOG4CXX_LIBRARY_DIRS})
########################################################################
# generate helper scripts to expand templated files
@@ -90,6 +92,7 @@ expand_cc(digital_chunks_to_symbols_XX bf bc sf sc if ic)
########################################################################
# Setup library
########################################################################
+
list(APPEND gr_digital_sources
${generated_sources}
digital_impl_glfsr.cc
@@ -142,6 +145,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 a5c95ceb7d..3cbe116f6c 100644
--- a/gr-fcd/lib/CMakeLists.txt
+++ b/gr-fcd/lib/CMakeLists.txt
@@ -36,6 +36,9 @@ include_directories(
link_directories(${Boost_LIBRARY_DIRS})
+include_directories(${LOG4CXX_INCLUDE_DIRS})
+link_directories(${LOG4CXX_LIBRARY_DIRS})
+
########################################################################
# Setup library
########################################################################
@@ -67,7 +70,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-howto-write-a-block/CMakeLists.txt b/gr-howto-write-a-block/CMakeLists.txt
index 02b13c6b69..d5d04e24d0 100644
--- a/gr-howto-write-a-block/CMakeLists.txt
+++ b/gr-howto-write-a-block/CMakeLists.txt
@@ -94,6 +94,10 @@ if(NOT GNURADIO_CORE_FOUND)
message(FATAL_ERROR "GnuRadio Core required to compile howto")
endif()
+# Handle gr_log enable/disable
+include(GrMiscUtils) #define LIB_SUFFIX
+GR_LOGGING()
+
########################################################################
# Setup the include and linker paths
########################################################################
@@ -101,12 +105,14 @@ include_directories(
${CMAKE_SOURCE_DIR}/include
${GNURADIO_CORE_INCLUDE_DIRS}
${GRUEL_INCLUDE_DIRS}
+ ${LOG4CXX_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
)
link_directories(
${GNURADIO_CORE_LIBRARY_DIRS}
${GRUEL_LIBRARY_DIRS}
+ ${LOG4CXX_LIBRARY_DIRS}
${Boost_LIBRARY_DIRS}
)
diff --git a/gr-howto-write-a-block/cmake/Modules/FindLog4cxx.cmake b/gr-howto-write-a-block/cmake/Modules/FindLog4cxx.cmake
new file mode 100644
index 0000000000..b1e4f6f1f7
--- /dev/null
+++ b/gr-howto-write-a-block/cmake/Modules/FindLog4cxx.cmake
@@ -0,0 +1,28 @@
+# CMake module to find LOG4CXX library
+
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(PC_LOG4CXX liblog4cxx)
+
+FIND_PATH(
+ LOG4CXX_INCLUDE_DIRS
+ NAMES log4cxx/log4cxx.h
+ HINTS $ENV{LOG4CXX_DIR}/include
+ ${PC_LOG4CXX_INCLUDE_DIRS}
+ PATHS /usr/local/include
+ /usr/include
+)
+
+FIND_LIBRARY(
+ LOG4CXX_LIBRARIES
+ NAMES log4cxx
+ HINTS $ENV{LOG4CXX_DIR}/lib
+ ${PC_LOG4CXX_LIBRARIES}
+ PATHS /usr/local/lib
+ /usr/local/lib64
+ /usr/lib
+ /usr/lib64
+)
+
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(LOG4CXX DEFAULT_MSG LOG4CXX_LIBRARIES LOG4CXX_INCLUDE_DIRS)
+MARK_AS_ADVANCED(LOG4CXX_LIBRARIES LOG4CXX_INCLUDE_DIRS)
diff --git a/gr-howto-write-a-block/cmake/Modules/GrMiscUtils.cmake b/gr-howto-write-a-block/cmake/Modules/GrMiscUtils.cmake
index 9331d5debc..cffe2f6540 100644
--- a/gr-howto-write-a-block/cmake/Modules/GrMiscUtils.cmake
+++ b/gr-howto-write-a-block/cmake/Modules/GrMiscUtils.cmake
@@ -208,3 +208,35 @@ function(GR_GEN_TARGET_DEPS name var)
set(${var} "DEPENDS;${name};COMMAND;${name}" PARENT_SCOPE)
endif()
endfunction(GR_GEN_TARGET_DEPS)
+
+
+########################################################################
+# 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/gr-howto-write-a-block/lib/CMakeLists.txt b/gr-howto-write-a-block/lib/CMakeLists.txt
index 835ae02d60..a55bb1fa4a 100644
--- a/gr-howto-write-a-block/lib/CMakeLists.txt
+++ b/gr-howto-write-a-block/lib/CMakeLists.txt
@@ -23,7 +23,11 @@
include(GrPlatform) #define LIB_SUFFIX
add_library(gnuradio-howto SHARED howto_square_ff.cc howto_square2_ff.cc)
-target_link_libraries(gnuradio-howto ${Boost_LIBRARIES} ${GRUEL_LIBRARIES} ${GNURADIO_CORE_LIBRARIES})
+target_link_libraries(gnuradio-howto
+ ${Boost_LIBRARIES}
+ ${GRUEL_LIBRARIES}
+ ${GNURADIO_CORE_LIBRARIES}
+ ${LOG4CXX_LIBRARIES})
set_target_properties(gnuradio-howto PROPERTIES DEFINE_SYMBOL "gnuradio_howto_EXPORTS")
########################################################################
diff --git a/gr-noaa/lib/CMakeLists.txt b/gr-noaa/lib/CMakeLists.txt
index 3f369f8aff..4216f1dc65 100644
--- a/gr-noaa/lib/CMakeLists.txt
+++ b/gr-noaa/lib/CMakeLists.txt
@@ -29,6 +29,9 @@ include_directories(
link_directories(${Boost_LIBRARY_DIRS})
+include_directories(${LOG4CXX_INCLUDE_DIRS})
+link_directories(${LOG4CXX_LIBRARY_DIRS})
+
########################################################################
# Setup library
########################################################################
@@ -41,6 +44,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 cb62bcc752..13c9b55465 100644
--- a/gr-pager/lib/CMakeLists.txt
+++ b/gr-pager/lib/CMakeLists.txt
@@ -29,6 +29,9 @@ include_directories(
link_directories(${Boost_LIBRARY_DIRS})
+include_directories(${LOG4CXX_INCLUDE_DIRS})
+link_directories(${LOG4CXX_LIBRARY_DIRS})
+
########################################################################
# Setup library
########################################################################
@@ -46,6 +49,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 49fa525d7e..380c235ccb 100644
--- a/gr-qtgui/lib/CMakeLists.txt
+++ b/gr-qtgui/lib/CMakeLists.txt
@@ -67,12 +67,14 @@ include_directories(
${GRUEL_INCLUDE_DIRS}
${QWT_INCLUDE_DIRS}
${QT_INCLUDE_DIRS}
+ ${LOG4CXX_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
${PYTHON_INCLUDE_DIRS}
)
link_directories(
${QWT_LIBRARY_DIRS}
+ ${LOG4CXX_LIBRARY_DIRS}
${Boost_LIBRARY_DIRS}
)
@@ -86,6 +88,7 @@ list(APPEND qtgui_libs
${QWT_LIBRARIES}
${QT_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 38154755c1..e554f0570f 100644
--- a/gr-shd/lib/CMakeLists.txt
+++ b/gr-shd/lib/CMakeLists.txt
@@ -31,6 +31,9 @@ include_directories(
link_directories(${SHD_LIBRARY_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 e2abf0238f..2fd4247a6d 100644
--- a/gr-trellis/src/lib/CMakeLists.txt
+++ b/gr-trellis/src/lib/CMakeLists.txt
@@ -32,6 +32,9 @@ include_directories(
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
########################################################################
@@ -150,6 +153,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 c494fddad5..e37c303ac4 100644
--- a/gr-uhd/lib/CMakeLists.txt
+++ b/gr-uhd/lib/CMakeLists.txt
@@ -34,6 +34,9 @@ link_directories(
${Boost_LIBRARY_DIRS}
)
+include_directories(${LOG4CXX_INCLUDE_DIRS})
+link_directories(${LOG4CXX_LIBRARY_DIRS})
+
########################################################################
# Setup library
########################################################################
@@ -47,6 +50,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 3050926bd7..16eff90982 100644
--- a/gr-video-sdl/src/CMakeLists.txt
+++ b/gr-video-sdl/src/CMakeLists.txt
@@ -25,6 +25,7 @@ include_directories(
${GNURADIO_CORE_INCLUDE_DIRS}
${GRUEL_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
+ ${LOG4CXX_INCLUDE_DIRS}
${SDL_INCLUDE_DIR}
)
@@ -42,6 +43,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 43a4156d06..352f1d2d3b 100644
--- a/gr-vocoder/lib/CMakeLists.txt
+++ b/gr-vocoder/lib/CMakeLists.txt
@@ -29,6 +29,9 @@ include_directories(
link_directories(${Boost_LIBRARY_DIRS})
+include_directories(${LOG4CXX_INCLUDE_DIRS})
+link_directories(${LOG4CXX_LIBRARY_DIRS})
+
########################################################################
# Setup library
########################################################################
@@ -61,6 +64,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 f446adb9c2..b4c6b99f4b 100644
--- a/gr-wavelet/lib/CMakeLists.txt
+++ b/gr-wavelet/lib/CMakeLists.txt
@@ -35,6 +35,9 @@ link_directories(${Boost_LIBRARY_DIRS})
link_directories(${GSL_LIBRARY_DIRS})
add_definitions(${GSL_DEFINITIONS})
+include_directories(${LOG4CXX_INCLUDE_DIRS})
+link_directories(${LOG4CXX_LIBRARY_DIRS})
+
########################################################################
# Setup library
########################################################################
@@ -49,6 +52,7 @@ list(APPEND wavelet_libs
${Boost_LIBRARIES}
${WAVELET_LIBRARIES}
${GSL_LIBRARIES}
+ ${LOG4CXX_LIBRARIES}
)
add_library(gnuradio-wavelet SHARED ${gr_wavelet_sources})