ros2 / ros2/rclcpp

Feature Request: Allow to disable logger by name

Open
#2,190 8 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement help wanted
Dominant language
C++
Stars
805
Forks
564
Avg merge
1d 17h
Merged PRs (30d)
27

Description

Feature request

Allow to disable a logger by name

Feature description

It would be nice to have a possibility to disable a certain logger completely from code. I have a c++ node which uses moveit internally. Moveit uses a lot of named loggers (e.g. moveit_robot_model.robot_model). As the logging information from some of these loggers is rather irrelevant and distracts from valuable information I would like to completely silence these loggers (at least from the console output) e.g. by calling something like:

rclcpp::get_logger("moveit_robot_model.robot_model").disable();

What I already tried was to set the logger level to Fatal or Error.

rclcpp::get_logger("moveit_robot_state.robot_model").set_level(rclcpp::Logger::Level::Fatal);

This didn't seem to work. (I would guess moveit sets the log level internally to something else, or there is some other magic happening?)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the rclcpp::get_logger and Logger::set_level entry points mentioned in the issue, then trace how named logger levels affect console output. Define and test behavior for completely silencing one named logger, including the interaction with existing level changes; done means the requested logger can be disabled from code without suppressing unrelated loggers.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
observability
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.