How to change log directory on ROS2 Foxy?
Both variables ROS_HOME and ROS_LOG_DIR were empty. I set them both to the desired folder. Yet logs are being saved at the default folder ~/.ros/logs
ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
Both variables ROS_HOME and ROS_LOG_DIR were empty. I set them both to the desired folder. Yet logs are being saved at the default folder ~/.ros/logs
I haven't seen any references to changing the log file directory, but there are two options:
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 usingros2 topic echo /rosout
. An alternative is to userqt
which has plugins for reading and filtering logs
Asked: 2021-05-13 12:05:24 -0600
Seen: 799 times
Last updated: May 13 '21