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

set log level in launch file

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

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
6

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

galou gravatar image

Self answer: http://wiki.ros.org/rosconsole#Config...

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

edit flag offensive delete link more

Comments

Please mark your answer as correct.

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

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

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

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

Rufus gravatar image

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

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

Comments

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/tcpros_service.py", line 152, in wait_for_service
    uri = contact_service(resolved_name)
  File "/opt/ros/noetic/lib/python3/dist-packages/rospy/impl/tcpros_service.py", line 113, in contact_service
    s.connect(addr)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:
...
  File "/opt/ros/noetic/lib/python3/dist-packages/rospy/rostime.py", 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 -0600 )edit
-1

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

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'}'"/>
</group>

But it somehow failes for me....

edit flag offensive delete link more

Comments

2

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 -0600 )edit

Question Tools

2 followers

Stats

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

Seen: 22,638 times

Last updated: Apr 04 '21