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

ROS_LOG_DIR not affecting where logs are written - ROS2 Eloquent

asked 2020-06-19 10:44:46 -0500

srubs_r gravatar image

I would like change the directory where ROS2 is storing logs. Here it indicates that setting the ROS_LOG_DIR environment variable overwrites the default log directory in ROS though I am not sure that it is the case with ROS2. I have tried setting the ROS_LOG_DIR environment variable but the log file location defaults to ~/.ros/log.

I have also tried this in the official ROS docker container with the same result.

Is there a ROS2 method to change the directory in which logs are written?

My system details are as follows:

  • OS - Ubuntu 18.04
  • ROS version - ROS2 Eloquent
  • CPU architecture - arm64

ROS environment variables:

edit retag flag offensive close merge delete


Have you fixed this problem? I have encountered the same problem in ros2 foxy.

Phymin gravatar image Phymin  ( 2020-11-02 23:11:41 -0500 )edit

I never got a solution to the problem. I am running ROS in a Docker container and am just mapping the internal /root/.ros directory to a specific location outside the container to make the logs persistent.

srubs_r gravatar image srubs_r  ( 2020-11-03 06:30:36 -0500 )edit

1 Answer

Sort by » oldest newest most voted

answered 2022-03-01 04:10:39 -0500

ph0enix gravatar image

The issue is that support for setting logging directory was added in Galactic as mentioned in the docs for versions before Foxy.

It was backported to foxy in Jan, 2021 (see this pr) which is why the documentation for foxy does not have the note.

I struggled with this for about a day before realizing I was using an older version of Foxy so I am posting this for any other poor souls with a similar setup.

edit flag offensive delete link more

Question Tools



Asked: 2020-06-19 10:44:46 -0500

Seen: 397 times

Last updated: Jun 19 '20