Robotics StackExchange | Archived questions

ROS_LOG_DIR not affecting where logs are written - ROS2 Eloquent

I would like change the directory where ROS2 is storing logs. Here it indicates that setting the ROSLOGDIR 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 ROSLOGDIR 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:

ROS environment variables:

ROS_LOG_DIR=/home/../Downloads/test_logs
ROS_PARAMS_PATH=/home/../../../package/launch/node_params.yaml
ROS_VERSION=2
ROS_LOCALHOST_ONLY=0
ROS_PYTHON_VERSION=3
ROS_PACKAGE_PATH=/home/../../../package/install/gps_umd/share
ROS_DISTRO=eloquent

Asked by srubs_r on 2020-06-19 10:44:46 UTC

Comments

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

Asked by Phymin on 2020-11-03 00:11:41 UTC

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.

Asked by srubs_r on 2020-11-03 07:30:36 UTC

Answers

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.

Asked by ph0enix on 2022-03-01 05:10:39 UTC

Comments