0
$\begingroup$

Rosanswers logo

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.


Originally posted by Pablo Iñigo Blasco on ROS Answers with karma: 2982 on 2020-11-20

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by gvdhoorn with karma: 86574 on 2020-11-21

This answer was ACCEPTED on the original site

Post score: 2

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.