ROS Resources: Documentation | Support | Discussion Forum | Service Status | Q&A

What is the log mechanism plan in ROS2?

In version Ardent of ROS2, the log mechanism is not complete. No file create.
What is the development plan for log mechanism in ROS2?

We are aware that it is a useful feature currently missing. While it is enumerated on the roadmap it is currently not actively being worked on.

About logging to a file, on ROS 1, we have disabled this mechanism, tell every node to log to screen and then used systemd’s journal to log the system on our robots.

So, while waiting for this feature in ROS2, if you are on Linux, you may try a system-wide logging system.

Whats for those without systemd? Can we log to syslog?

It will be a bit more tricky because systemd directly uses stdout and stderr to log in the journal.

I read that as “ros2 works without systemd”, just won’t have logging. Which would be good, have not tested that yet.

For syslog, logging might be possible to hack with the “logger” command as a short term solution.

I like the idea of using the logging system from the OS since it is usually better documented, e.g. I always missed tuning the timestamp output of the ros1 logger.

To be clear, we will probably have some file logging at some point in the future that is separate from a system logger, just because during development you often do not use the system logger day to day. For production system that makes sense though, and because of that it should be possible to disable file logging in favor of just printing to stdout/stderr.

There is an increasing number of tools in the web development world that provide flexible logging, which might be able to handle both development and production logging. One of our people did an extensive review of them all a few months ago. I will need to talk to him to find out how they compare to the “traditional” ones like log4cpp.