Add logger service description#3477
Conversation
|
overall looks good to me, note that this doc should be merged in rolling and iron only. |
|
@clalancette now ros2/demos#611 is merged, this is good to go now? |
|
@clalancette friendly ping. |
clalancette
left a comment
There was a problem hiding this comment.
I've left a bunch of things to fix inline.
But my bigger concern here is that the way that this is currently structured, it doesn't exactly give the user something to run. It describes how to implement it, but not really how to run the demos. I think I'd rather see show how to run use_logger_service, and then make the service calls on it to get/set the level.
| 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). | ||
| **This concept is not yet officially supported in ROS 2.** | ||
| 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. | ||
| You can use logger service to implement external configuration of loggers at runtime. |
There was a problem hiding this comment.
| You can use logger service to implement external configuration of loggers at runtime. | |
| You can use the node logger service to externally configure loggers at runtime. |
|
|
||
| The demo previously started is already running this example service. | ||
| To set the level of the demo's logger back to ``INFO``\ , call the service with: | ||
| The following code shows how to enable logger service while creating node. |
There was a problem hiding this comment.
| The following code shows how to enable logger service while creating node. | |
| The following code shows how to enable the logger service while creating the node. |
| # Create a node with logger service enabled | ||
| node = Node('NodeWithLoggerService', enable_logger_service=True) | ||
|
|
||
| You will find 2 services under node `NodeWithLoggerService` by running `ros2 service list` |
There was a problem hiding this comment.
| You will find 2 services under node `NodeWithLoggerService` by running `ros2 service list` | |
| If you run one of the nodes as configured above, you will find 2 services when running ``ros2 service list``: |
|
|
||
| * get_logger_levels | ||
|
|
||
| Use this service to get logger levels by specified logger names. |
There was a problem hiding this comment.
| Use this service to get logger levels by specified logger names. | |
| Use this service to get logger levels for specified logger names. |
| Run `ros2 srvice call` to get logger levels for `NodeWithLoggerService` and `rcl`. | ||
| .. code-block:: bash |
There was a problem hiding this comment.
| Run `ros2 srvice call` to get logger levels for `NodeWithLoggerService` and `rcl`. | |
| .. code-block:: bash | |
| Run ``ros2 service call`` to get logger levels for ``NodeWithLoggerService`` and `rcl``. | |
| .. code-block:: bash |
| Run `ros2 service call` to set logger levels for `NodeWithLoggerService` and `rcl`. | ||
| .. code-block:: bash |
There was a problem hiding this comment.
| Run `ros2 service call` to set logger levels for `NodeWithLoggerService` and `rcl`. | |
| .. code-block:: bash | |
| Run ``ros2 service call`` to set logger levels for ``NodeWithLoggerService`` and ``rcl``. | |
| .. code-block:: bash |
| rcl_interfaces.srv.SetLoggerLevels_Response(results=[rcl_interfaces.msg.SetLoggerLevelsResult(successful=True, reason=''), rcl_interfaces.msg.SetLoggerLevelsResult(successful=True, reason='')]) | ||
|
|
||
|
|
||
| There are demo code on how to set/get logger level via logger service. |
There was a problem hiding this comment.
| There are demo code on how to set/get logger level via logger service. | |
| There is also demo code showing how to set or get the logger level via the logger service. |
| .. warning:: | ||
|
|
||
| You should see debug output from ``rcl`` start to show. | ||
| Currently, there is a limitation that `get_logger_levels` and `set_logger_levels` services are not thread-safe. |
There was a problem hiding this comment.
| Currently, there is a limitation that `get_logger_levels` and `set_logger_levels` services are not thread-safe. | |
| Currently, there is a limitation that ``get_logger_levels`` and ``set_logger_levels`` services are not thread-safe. |
Barry-Xu-2018
left a comment
There was a problem hiding this comment.
Thanks for your comments.
But my bigger concern here is that the way that this is currently structured, it doesn't exactly give the user something to run. It describes how to implement it, but not really how to run the demos. I think I'd rather see show how to run use_logger_service, and then make the service calls on it to get/set the level.
In the document, it described how to enable the logger service and how to get/set logger by CLI. If users want to use code to change logger, demo are reference. Demo is easy to run (No special operation). Users can look at the code of demo to understand how to use code to get/set logger via logger service. Anyway, I will add how to run demo in document.
| 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). | ||
| **This concept is not yet officially supported in ROS 2.** | ||
| 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. | ||
| You can use logger service to implement external configuration of loggers at runtime. |
|
|
||
| The demo previously started is already running this example service. | ||
| To set the level of the demo's logger back to ``INFO``\ , call the service with: | ||
| The following code shows how to enable logger service while creating node. |
| # Create a node with logger service enabled | ||
| node = Node('NodeWithLoggerService', enable_logger_service=True) | ||
|
|
||
| You will find 2 services under node `NodeWithLoggerService` by running `ros2 service list` |
|
|
||
| * get_logger_levels | ||
|
|
||
| Use this service to get logger levels by specified logger names. |
| Run `ros2 srvice call` to get logger levels for `NodeWithLoggerService` and `rcl`. | ||
| .. code-block:: bash |
|
|
||
| * set_logger_levels | ||
|
|
||
| Use this service to set logger levels by specified logger names. |
| Run `ros2 service call` to set logger levels for `NodeWithLoggerService` and `rcl`. | ||
| .. code-block:: bash |
| .. warning:: | ||
|
|
||
| You should see debug output from ``rcl`` start to show. | ||
| Currently, there is a limitation that `get_logger_levels` and `set_logger_levels` services are not thread-safe. |
|
@clalancette Please review again a6e18b9 |
|
@clalancette friendly ping on this. |
clalancette
left a comment
There was a problem hiding this comment.
A couple more things to fix, then I think this will be ready to merge.
|
@clalancette Updated base on your comments at cdb07a4 |
Signed-off-by: Barry Xu <barry.xu@sony.com>
Signed-off-by: Barry Xu <barry.xu@sony.com>
Signed-off-by: Barry Xu <barry.xu@sony.com>
Signed-off-by: Barry Xu <barry.xu@sony.com>
Signed-off-by: Chris Lalancette <clalancette@gmail.com>
cdb07a4 to
0b14190
Compare
* Add logger service description Signed-off-by: Barry Xu <barry.xu@sony.com> Co-authored-by: Chris Lalancette <clalancette@gmail.com> (cherry picked from commit c60d0e1)
Depend on
ros2/demos#611