ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

how to set up log level by package at startup?

asked 2020-11-20 14:31:25 -0500

Is there a way to configure the logging level associated to a package independently of the node or the executable it is located in?

For example. In ROS1 navigation stack I could develop a planner as a plugin that was loaded by move_base. I could in that case disable setup the log level of move_base to X and the log level of my planner to Y.

That was possible using the a configuration file such as the following:

log4j.logger.ros=INFO
log4j.logger.ros.roscpp.superdebug=WARN
log4j.logger.ros.move_base=INFO
log4j.logger.ros.myplanner=DEBUG

and referencing that file with the environament variable "ROSCONSOLE_CONFIG_FILE".

Is it possible to do something similar in ROS2? maybe passing some argument to the executable with ros nodes?

Note: Using --ros-args --log-level INFO looks insufficent since looks like it cannot filter by package.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
2

answered 2020-11-21 05:04:02 -0500

gvdhoorn gravatar image

updated 2020-11-21 05:04:18 -0500

I believe this will be supported in Galactic Geochelone.

From the (I guess pre) release notes (specifically here):

New features in this ROS 2 release

Ability to specify per-logger log levels

It is now possible to specify different logging levels for different loggers on the command line:

ros2 run demo_nodes_cpp talker --ros-args --log-level WARN --log-level talker:=DEBUG

The above command sets a global log level of WARN, but sets the log level of the talker node messages to DEBUG. The --log-level command-line option can be passed an arbitrary number of times to set different log levels for each logger.

It's likely the same functionality will then also be exposed by launch_ros.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2020-11-20 14:31:25 -0500

Seen: 825 times

Last updated: Nov 21 '20