Robotics StackExchange | Archived questions

Is there a way to enable debug logging for colcon test?

I have a gtest bar in package foo, which I generate with CMake using ament_add_gtest(). It can be run as part of colcon test, or individually by calling ws/build/foo/test/bar.

There is a a test that is failing and I would like to re-run the test with debug rclcpp logging enabled. Is there a way to do this?

Asked by ijnek on 2021-09-25 08:13:06 UTC

Comments

Have you checked this document https://docs.ros2.org/bouncy/api/rclcpp/logging_8hpp.html?

Asked by osilva on 2021-09-26 05:05:32 UTC

There is also this article that maybe helpful: https://discourse.ros.org/t/what-of-ros2-is-ros-debug-of-ros1-equivalent-to/4740

Asked by osilva on 2021-09-26 05:06:49 UTC

@osilva, thanks for your response. Perhaps my question seemed like how to do logging in general, apologies. Usually I debug nodes by running ros2 run foo bar --ros-args --log-level DEBUG in ROS2, and that works fine. However, tests can't be run using ros2 run so I want to know how I can enable them for gtest executables.

Asked by ijnek on 2021-09-26 05:23:21 UTC

Thank you for the clarification. Your question was clear I needed to read it more carefully too.

Asked by osilva on 2021-09-26 08:15:27 UTC

Answers