You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/Tutorials/Demos/Logging-and-logger-configuration.rst
+72-12Lines changed: 72 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -232,26 +232,86 @@ See `the source code <https://github.com/ros2/demos/blob/{REPOS_FILE_BRANCH}/log
232
232
Logger level configuration: externally
233
233
--------------------------------------
234
234
235
-
In the future there will be a generalized approach to external configuration of loggers at runtime (similar to how `rqt_logger_level <https://wiki.ros.org/rqt_logger_level>`__ in ROS 1 allows logger configuration via remote procedural calls).
236
-
**This concept is not yet officially supported in ROS 2.**
237
-
In the meantime, this demo provides an **example** service that can be called externally to request configuration of logger levels for known names of loggers in the process.
235
+
ROS 2 nodes have services available to configure the logging level externally at runtime.
236
+
These services are disabled by default.
237
+
The following code shows how to enable the logger service while creating the node.
238
238
239
-
The demo previously started is already running this example service.
240
-
To set the level of the demo's logger back to ``INFO``\ , call the service with:
239
+
.. tabs::
241
240
242
-
.. code-block:: bash
241
+
.. group-tab:: Linux
242
+
243
+
.. code-block:: C++
243
244
244
-
ros2 service call /config_logger logging_demo/srv/ConfigLogger "{logger_name: 'logger_usage_demo', level: INFO}"
245
+
// Create a node with logger service enabled
246
+
auto node = std::make_shared<rclcpp::Node>("NodeWithLoggerService", rclcpp::NodeOptions().enable_logger_service(true))
245
247
246
-
This service call will work on any logger that is running in the process provided that you know its name.
247
-
This includes the loggers in the ROS 2 core, such as ``rcl`` (the common client library package).
0 commit comments