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

How to change log directory on ROS2 Foxy?

asked 2021-05-13 12:05:24 -0600

apoorvcn47 gravatar image

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

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-05-13 15:20:26 -0600

Spectre gravatar image

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

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2021-05-13 12:05:24 -0600

Seen: 799 times

Last updated: May 13 '21