Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure logging to not write to file system #88

Open
sloretz opened this issue Jun 10, 2022 · 2 comments
Open

Configure logging to not write to file system #88

sloretz opened this issue Jun 10, 2022 · 2 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@sloretz
Copy link
Contributor

sloretz commented Jun 10, 2022

Currently the default logger rcl_logging_spdlog always tries to write to the file system, and errors if it can't. This prevents it from being used on systems with read-only file systems. It should be configurable to allow outputting to the console only.

Related discussion #86 (comment)
Summary: New environment variable RCL_LOGGING_OUTPUT_SINK that defaults to console,file if unset.

@sloretz sloretz added enhancement New feature or request help wanted Extra attention is needed labels Jun 10, 2022
@ros-discourse
Copy link

This issue has been mentioned on ROS Discourse. There might be relevant details there:

https://discourse.ros.org/t/ros2-logging-to-docker-daemon/26563/2

@clalancette
Copy link
Contributor

Currently the default logger rcl_logging_spdlog always tries to write to the file system, and errors if it can't. This prevents it from being used on systems with read-only file systems. It should be configurable to allow outputting to the console only.

So after reading through the logging code the last couple of weeks, I actually think we don't need a new environment variable at all.

The way that logging works is that as log messages come through the rcutils layer, a callback into rcl gets called. That callback formats the log message, and then figures out where to send it:

  • To the console via rcutils
  • To disk via rcl_logging_spdlog
  • To the network via /rosout

In turn, it is possible to enable or disable each of those at node initialization time. For instance, to have messages only go out to the console (and not written to disk or to the network):

ros2 run demo_nodes_cpp talker --ros-args --disable-external-lib-logs --disable-rosout-logs

And this can even be set on a per-composable node basis. So I think we have this functionality already, we just don't have it well documented.

@sloretz What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants