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

set log level in launch file

asked 2014-11-21 09:24:25 -0500

galou gravatar image

Is there a way to set the log level for a node in a launch file?

I would find this practical.

Cheers, Gaël

edit retag flag offensive close merge delete

3 Answers

Sort by » oldest newest most voted

answered 2015-02-13 05:39:26 -0500

galou gravatar image

Self answer:

The feature is not launch-file specific and works by setting an environment variable to a configuration file.

edit flag offensive delete link more


Please mark your answer as correct.

BennyRe gravatar image BennyRe  ( 2015-02-16 04:37:28 -0500 )edit

Actually, my own answer seems to work only for roscpp node.

galou gravatar image galou  ( 2015-09-11 06:45:13 -0500 )edit

answered 2020-04-28 02:56:07 -0500

Rufus gravatar image

updated 2021-04-04 22:43:12 -0500

Combining calling rosservice in launch file and setting log level with rosservice, the launch-file specific way would be the following

<node pkg="rosservice" type="rosservice" name="set_move_base_log_level" args="call --wait /move_base/set_logger_level 'ros.move_base' 'debug'" />

I wouldn't be surprised if there's a proper launch file specific way of doing this... if someone knows, please enlighten us!

edit flag offensive delete link more


Sometimes a rosnode cleanup is required prior to the launch that contains this, otherwise the --wait results in this (at least in noetic)

Traceback (most recent call last):
  File "/opt/ros/noetic/lib/python3/dist-packages/rospy/impl/", line 152, in wait_for_service
    uri = contact_service(resolved_name)
  File "/opt/ros/noetic/lib/python3/dist-packages/rospy/impl/", line 113, in contact_service
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:
  File "/opt/ros/noetic/lib/python3/dist-packages/rospy/", line 190, in get_rostime
    raise rospy.exceptions.ROSInitException("time is not initialized. Have you called init_node()?")
rospy.exceptions.ROSInitException: time is not initialized. Have you called init_node()?
lucasw gravatar image lucasw  ( 2021-09-14 11:10:30 -0500 )edit

answered 2019-03-07 00:21:23 -0500

Markus gravatar image

Well I just tried it in kinetik like this:

<group if="$(arg use_DEBUG_OUTPUT)" >
         <node pkg="rosservice" type="rosservice" name="set_logger_level" args="call /tf_mapping_node/set_logger_level '{logger: 'rosout', level: 'ERROR'}'"/>

But it somehow failes for me....

edit flag offensive delete link more



Please don't answer a question just saying it doesn't work. Moreover the previous answer isn't even related to yours.

You would have more chances of being answered by asking a new question since the original question is very old.

Delb gravatar image Delb  ( 2019-03-07 01:19:22 -0500 )edit

Question Tools



Asked: 2014-11-21 09:24:25 -0500

Seen: 21,805 times

Last updated: Apr 04 '21