Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I haven't seen any references to changing the log file directory, but there are two options:

  1. Use a logging configuration file
  2. Changing the logger used / changing whether rosout or stdout are used.

On the "ROS2 Design" blog there is a pretty nice overview of ROS2 command-line arguments: here

If you were able to change a log file directory I would expect there to be a ros2 CLI argument, but on that page there is none. However as I mentioned above it does look like there is an unexplained "config file"

For external logging configuration, use --log-config-file path/to/file.config and a log configuration file.

The bad news is that I wasn't the first one to wonder about the lack of documentation for this config file: ROS2 Answers, "Documentation for ros2 log config?"

The poster received no response, and that was posted this January so it's fairly "recent".

I was also able to find another reference to logging from July 2019 regarding logging to a specific file: here

(User "alsora", July 22, 2019) 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