-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add logger service description #3477
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
|
||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
# 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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``: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
|
||
* get_logger_levels | ||
|
||
Use this service to get logger levels by specified logger names. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use this service to get logger levels by specified logger names. | |
Use this service to get logger levels for specified logger names. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
Run `ros2 srvice call` to get logger levels for `NodeWithLoggerService` and `rcl`. | ||
.. code-block:: bash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
Run `ros2 service call` to set logger levels for `NodeWithLoggerService` and `rcl`. | ||
.. code-block:: bash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
|
||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
|
||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
# 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
|
||
* get_logger_levels | ||
|
||
Use this service to get logger levels by specified logger names. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
Run `ros2 srvice call` to get logger levels for `NodeWithLoggerService` and `rcl`. | ||
.. code-block:: bash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
|
||
* set_logger_levels | ||
|
||
Use this service to set logger levels by specified logger names. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
Run `ros2 service call` to set logger levels for `NodeWithLoggerService` and `rcl`. | ||
.. code-block:: bash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
|
||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
@clalancette Please review again a6e18b9 |
@clalancette friendly ping on this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <[email protected]>
Signed-off-by: Barry Xu <[email protected]>
Signed-off-by: Barry Xu <[email protected]>
Signed-off-by: Barry Xu <[email protected]>
Signed-off-by: Chris Lalancette <[email protected]>
cdb07a4
to
0b14190
Compare
* Add logger service description Signed-off-by: Barry Xu <[email protected]> Co-authored-by: Chris Lalancette <[email protected]> (cherry picked from commit c60d0e1)
* Add logger service description Signed-off-by: Barry Xu <[email protected]> Co-authored-by: Chris Lalancette <[email protected]> (cherry picked from commit c60d0e1) Co-authored-by: Barry Xu <[email protected]>
Depend on
ros2/demos#611