Closed jacobperron closed 4 years ago
which is hardcoded in the following places:
And in launch
: https://github.com/ros2/launch/blob/e51484685387d4186358ad128d3a4232a5d06522/launch/launch/logging/__init__.py#L96
In ROS 1, we can change the directory logs are saved to by setting the ROS_HOME environment variable.
Actually ROS_LOG_DIR.
Thanks, I've updated the description.
@jacobperron What do you think we should do with this ticket? Assign to you? Backlog? Help wanted?
In ROS 1, we can change the directory logs are saved to by setting the ROS_HOME and/or ROS_LOG_DIR environment variables. It would be nice to have a way to configure the directory in ROS 2.
I think an environment variable is a convenient way for users to configure the logging directory, although I propose using a single environment variable instead of combining two (like in ROS 1).
I think a ROS2_HOME
(or something similar) env var would be useful for ROS 2 in general. Maybe it's out of scope for rcl_logging, but, for tracing, we're using ~/.ros/tracing
, although it's semi-hardcoded. There is a CLI option to override the directory, but I think using $ROS2_HOME/tracing
by default would make for a slightly more uniform experience. I guess that's why ROS 1 did it like that.
@christophebedard Good point. I like the idea of having env variables for both the ROS "home" directory and log directory.
What do you think we should do with this ticket? Assign to you? Backlog? Help wanted?
I don't expect to get to this any time soon. It seems like a good help wanted ticket, if there are no strong objections to using an environment variable.
@jacobperron I can do it!
Just to confirm, I'll go with this (again, if there are no strong objections):
$ROS2_LOG_DIR
if ROS2_LOG_DIR
is set.$ROS2_HOME/log
, using ~/.ros
for ROS2_HOME
if not set.I can also apply the same logic to launch
.
@christophebedard Thanks, sounds good to me!
FYI (to everybody in the thread), the opened PRs are using ROS_LOG_DIR
and ROS_HOME
instead of ROS2_*
(for consistency with other environment variable names, see comment).
https://github.com/ros2/ros2_documentation/pull/882 documents how the feature work.
Currently, all logs are saved to the directory
~/.ros/log
, which is hardcoded in the following places:https://github.com/ros2/rcl_logging/blob/07463919e1a791d7acf69d70f8f06a51b3115319/rcl_logging_log4cxx/src/rcl_logging_log4cxx/rcl_logging_log4cxx.cpp#L135
https://github.com/ros2/rcl_logging/blob/07463919e1a791d7acf69d70f8f06a51b3115319/rcl_logging_spdlog/src/rcl_logging_spdlog.cpp#L101
https://github.com/ros2/launch/blob/e51484685387d4186358ad128d3a4232a5d06522/launch/launch/logging/__init__.py#L96
In ROS 1, we can change the directory logs are saved to by setting the
ROS_HOME
and/orROS_LOG_DIR
environment variables. It would be nice to have a way to configure the directory in ROS 2.I think an environment variable is a convenient way for users to configure the logging directory, although I propose using a single environment variable instead of combining two (like in ROS 1).