Ask Your Question

how to set up log level by package at startup?

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

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:


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

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

gvdhoorn gravatar image

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

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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



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

Seen: 239 times

Last updated: Nov 21 '20