Skip to content

ros2log new 1st class command group support #1148

@fujitatomoya

Description

@fujitatomoya

Description

Provide a dedicated ros2log command group in ros2cli repository to inspect and manipulate ROS 2 runtime logging configuration on nodes. This would unify and improve the user experience for logging-related actions (such as setting/getting log level) compared to the existing scattered approaches (e.g., ad-hoc subcommands or raw service calls).

Motivation

Logging configuration from the command line is limited or inconsistent (e.g., only default log-level flags in some commands), and there is no central dedicated CLI for logging operations. As ROS 2 logging is crucial for debugging and production diagnostics, users need a clear and ergonomic CLI to interact with it.

  • Consistent CLI UX for logging across ROS 2.
  • Avoids error-prone workflows (e.g., manual service calls).
  • Makes logging control discoverable via ros2 log --help.
  • Facilitates production debugging and runtime introspection.

Design / Implementation Considerations

Proposed Functionality: Introduce a new ros2 log CLI with subcommands

Subcommand Description
ros2 log list List nodes that support runtime log configuration
ros2 log levels Show all valid log level values (e.g., DEBUG, INFO, WARN, ERROR, FATAL)
ros2 log get <node> Retrieve the current log level of a node (Could optionally show all loggers under that node)
ros2 log set <node> <level> Set the log level of a node
ros2 log watch <node> <level> Tail/monitor logs from a node via rosout (it tries to enable content filtering from rmw implementation)
ros2 log describe <node> Display metadata (available loggers, effective levels).

Note that above are just ideas, we might need more options and arguments for basic design.

We probably need to add some facility or API for client interface to get available logger names in the node from the logger hash map maintained in rcutils.
It would be nice to manage the endpoints with --all/-a options to set(reset) the logger levels globally.

Additional Information

Related Information:

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

Status

In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions