Add per node & component log level support
Los mantenedores suelen responder en 1 día
@penww ya está trabajando en esto.
Desde el 2/4/2026.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
Description
This issue tracks the addition of a log_level field to NodeOptions, allowing users to set the initial log severity for a node at construction time. This enables per-component log level customization, particularly useful in component container deployments.
Motivation
In ROS 2, all nodes loaded into a component container share the same process. Prior to this change, there was no way to specify a different initial log level for individual components at load time — the only option was to set a global log level or call set_level() programmatically after construction.
This is a common need in production deployments where:
- Different components have different verbosity requirements (e.g., a sensor driver at
WARN, a planner atDEBUG). - Operators want to configure log levels declaratively via launch files or
LoadNodeservice calls without modifying node source code. - Debugging a single component in a multi-component container should not require restarting the entire process with a global log level change.
We can see this feature has designed but not full implementation:
- LoadNode.srv defined
log_levelfield: https://github.com/ros2/rcl_interfaces/blob/79a773f9fb02dee0de23fb1b08ca4d187b313849/composition_interfaces/srv/LoadNode.srv#L17 - ros2component implement
log_levelargs but not parse: https://github.com/ros2/ros2cli/blob/401876461924b6bd4d4f9db95e22deb6243fce8b/ros2component/ros2component/api/__init__.py#L343 - component_manager not handle
log_levelin the LoadNode request: https://github.com/ros2/rclcpp/blob/f145c9ee04fbaa34f70b6f5cbbe095a6342f97c9/rclcpp_components/src/component_manager.cpp#L150
Expected Behavior:
- Set component log_level with CLI:
ros2 component load /ComponentManager <PKG> <PLUGIN> --log-level debug
- Set component log_level with launch:
def generate_launch_description():
return LaunchDescription([ComposableNodeContainer(
name='component_demo_container',
namespace='',
package='rclcpp_components',
executable='component_container',
composable_node_descriptions=[
ComposableNode(
package='<PKG>',
plugin='<PLUGIN>',
log_level='DEBUG', # component log level
),
],
arguments=['--ros-args', '--log-level', 'DEBUG'], # container log level
)])
Design / Implementation Considerations
NodeOptions API
A new log_level getter/setter pair is added to NodeOptions:
// Get the log level (RCUTILS_LOG_SEVERITY_* value; 0 = unset/default)
int log_level() const;
// Set the initial log level for this node
NodeOptions & log_level(int log_level);
The default value is RCUTILS_LOG_SEVERITY_UNSET (0), which preserves existing behavior — no level is applied at construction.
Node construction (node.cpp)
After the node is fully constructed, if log_level is not UNSET, the logger level is applied:
if (options.log_level() != RCUTILS_LOG_SEVERITY_UNSET) {
node_logging_->get_logger().set_level(
static_cast<rclcpp::Logger::Level>(options.log_level()));
}
This is intentionally applied after construction so the logger is fully initialized.
ComponentManager integration (component_manager.cpp)
When handling a LoadNode service request, the log_level field from the request is validated and forwarded to NodeOptions:
if (request->log_level != 0) {
// Validate against known RCUTILS severity values
options.log_level(request->log_level);
}
Invalid values (not one of DEBUG, INFO, WARN, ERROR, FATAL) throw a ComponentManagerException with a descriptive message.
Additional Information
No response
- Lenguaje dominante
- C++
- Estrellas
- 814
- Forks
- 572
- Merge medio
- 4 d 8 h
- PR fusionados (30 d)
- 18
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de ros2/rclcpp
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 10/100
Los mantenedores suelen responder en 1 día
-
:farmer: Flaky EventsCBGExecutor test: reentrant callback group fails to run callbacks concurrentlyAbiertobug
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
Los mantenedores suelen responder en 1 día
-
Copy constructor exception leaks intra-process message allocationPosiblemente ocupada @TinyGeek la tomó hace 3 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
Los mantenedores suelen responder en 1 día
-
[Jazzy] action server registers clock jump callbacks without the clock mutex (heap corruption)Posiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertobug
Dificultad 4/5 3-5 días Aptitud para principiantes 44/100
Los mantenedores suelen responder en 1 día
Todos los issues de ros2/rclcpp
Issues similares
-
ai_p1 comp-message-queues
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
ClickHouse/ClickHouse#125890 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
redis/memtier_benchmark#642 ·
Los mantenedores suelen responder en 1 día
-
Ctrl-C can abort a node: the state timer asks for the node names after shutdownPosiblemente ocupada @fmrico la tomó hoy. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
fmrico/cascade_lifecycle#24 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100