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

Revision history [back]

click to hide/show revision 1
initial version

In short, it is by design that all output from RCLCPP_{DEBUG,INFO,WARN,ERROR,FATAL} macros (and their equivalent logger.{debug,info,warn,error,fatal} in rclpy) goes to stderr.

Back in Dashing and Eloquent, we used to output DEBUG and INFO messages to stdout, and all of the other ones to stderr. However, this caused confusion and made it hard to handle log messages at every level since you would have to capture both stdout and stderr.

Between Eloquent and Foxy, I did some pretty exhaustive research into the logging systems in languages like Python, Ruby, Rust, etc. (see https://github.com/ros2/rcutils/pull/181#issuecomment-546553594). What I found out was that all logging systems pick a single stream and log to that. Most of them log to stdout by default, but some log to stderr by default. We decided to log everything to stderr, to keep stdout available for use by the application.

I'll point out that this is configurable; if you set the environment variable RCUTILS_LOGGING_USE_STDOUT to 1, it will use stdout by default.