ROS2 logging to daemond

asked 2022-06-03 05:18:50 -0500

BhanuKiran.Chaluvadi gravatar image


I am running a ros2 node (foxy/humble) inside a container(Entry point ros2 run ...). I am running a container in read only mode(because of some security reasons). so it can't or should not able to create any folders inside the containers. But ros2 logging requires it to create a folder in home directory or to some logging folder some where.

I was thinking more of a scenario where the ros2 logs only to stdout and stderr and doesn't create any folders on the home directory or doesn't require a logs directory location (since the container is read only). ros2 should output logs only to stdout and stderr. And the docker takes care of storing them in docker logs or may be forward them systemd based on docker configuration.

Is there a flag that I can set to restrict the logging only to stdout and stderr and no logging folder ?

edit retag flag offensive close merge delete


Looks like rcl_logging errors out on failing to create the log directory:
Could you create this directory in the container when building the image, or point $ROS_LOG_DIR to an existing directory? Does rcl still print to stdout even if the default logging plugin fails to write to disk?

Edit: looks like it'll fail even also when attempting to create a timestamped named log file:

Perhaps you may want to open a feature request there, and potentially a PR to include a bypass for read only filesystems. This could be implemented with support for an external configuration file TODO:

ruffsl gravatar image ruffsl  ( 2022-07-21 07:35:34 -0500 )edit