ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
At the moment logging to file is not directly possible with ROS2, unless you register a custom logger interface. It will be probably available soon https://discourse.ros.org/t/ros2-logging/6469/24?u=alsora
For what concerns enabling log to standard output, the command that you used is not entirely correct. You have to set the logger verbosity for a specific ROS2 application, not for the ROS2 command line interface.
The correct one would be something like this (for example for the publisher_lambda
demo executable)
ros2 run examples_rclcpp_minimal_publisher publisher_lambda __log_level:=debug
Inside your application, you can log using the following macro (assuming C++ application)
RCLCPP_INFO(node->get_logger(), "This is my log message");
By default, the messages will be also logged to a specific topic, named rosout
. (This behavior can be disabled using the parameter __log_disable_rosout:=true
)
So you can listen to them using
ros2 topic echo /rosout
An alternative is to use rqt
which has plugins for reading and filtering logs
2 | No.2 Revision |
At the moment logging to file is not directly possible with ROS2, unless you register a custom logger interface. It will be probably available soon https://discourse.ros.org/t/ros2-logging/6469/24?u=alsora
For what concerns enabling log to standard output, the command that you used is not entirely correct.
You have to set the logger verbosity for a specific ROS2 application, not for the ROS2 command line interface.application.
The correct one would be something like this (for example for the publisher_lambda
demo executable)
ros2 run examples_rclcpp_minimal_publisher publisher_lambda __log_level:=debug
Inside your application, you can log using the following macro (assuming C++ application)
RCLCPP_INFO(node->get_logger(), "This is my log message");
By default, the messages will be also logged to a specific topic, named rosout
. (This behavior can be disabled using the parameter __log_disable_rosout:=true
)
So you can listen to them using
ros2 topic echo /rosout
An alternative is to use rqt
which has plugins for reading and filtering logs