Robotics StackExchange | Archived questions

Where do ROSCPP_LOG_DEBUG messages go?

hello, can anyone tell me where debug messages using the ROSCPPLOGDEBUG macro go to? (its used quite extensively in the roscpp sources). I built roscpp from source and enabled debug build. I looked in ~/.ros/log but saw nothing of interest there

More generally, the info page at http://wiki.ros.org/roscpp/Overview/Logging says that "The base versions [of eg ROSDEBUG] output to a logger named "ros.yourpackage_name"" but I'm not sure what this means.

thanks

Asked by sunking on 2016-08-24 18:19:28 UTC

Comments

Answers

Per the documentation on http://wiki.ros.org/roscpp/Overview/Logging:

The default verbosity level is INFO, so DEBUG statements will not be seen by default.

If DEBUG is enabled, it goes to stdout and the /rosout topic. You can view the /rosout topic with rqt_console.

The docs also describe how to set the log level, to enable DEBUG:

Setting Verbosity Levels

There are three ways of setting verbosity levels on a roscpp node. The first is through a configuration file which sets the verbosity level for every node in the system, the second is at runtime through the rqt_logger_level (former rxloggerlevel) or rqt_console (former rxconsole) tools, and the third is programmatically through the rosconsole API:

I recommend starting with rqt_console because it allows you to view the log messages and all of the loggers and modify the verbosity level at run-time.

Asked by ahendrix on 2016-08-24 22:13:09 UTC

Comments

Tried rqt_console I see INFO msgs but still no DEBUG msgs. eg. this line in subscription.cpp should display every time a subscriber tries to XMLRPC connect with a publisher but it does not. ROSCPP_LOG_DEBUG("Began asynchronous xmlrpc connection to [%s:%d]", peer_host.c_str(), peer_port);

Asked by sunking on 2016-08-25 16:10:43 UTC

If you are using binaries built in release mode the debug logging macros will evaluate to nothing and essentially be removed for performance reasons.

So if you want to see the debug message on the console / rosout / rqt_console you have to make sure that you are building debug binaries (-DCMAKE_BUILD_TYPE=Debug).

Asked by Dirk Thomas on 2016-08-25 16:28:14 UTC

Comments

Yes that is what I am doing. I am building just roscpp using ./src/catkin/bin/catkin_make_isolated --install --pkg roscpp -DCMAKE_BUILD_TYPE=Debug and then copying the generated library install_isolated/lib/libroscpp.so to /opt/ros/indigo/lib. But I still don't see those ROSCPP_LOG_DEBUG messages

Asked by sunking on 2016-08-31 16:56:48 UTC

@Dirk, do you have any response to my follow up? As I said I am building the appropriate library debug build.

Asked by sunking on 2016-09-04 01:54:16 UTC

Since I don't know what you are using to configure the logging level I don't have a recommendation. When I use rqt_logger_level to change the level of the ros.roscpp.roscpp_internal logger of the talker node to Debug the talker starts printing more information when a new listener connects.

Asked by Dirk Thomas on 2016-09-06 13:34:15 UTC