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
The logs inside the LifecycleNode are not published to rosout making hard to debug issues when relying on rosout-reading tools (e.g foxglove). I guess the reason is because the rcutil logging macros are used instead of the rclcpp logging macros?
What would be the easiest way to enable publishing those logs to rosout? Thanks
So the logging subsystem uses a dependency-injection type of model. In particular, what happens is that the rcutils_logging APIs allow the registration of an arbitrary number of callbacks, and when a log message comes in, it calls each of those callbacks in turn. By default, rcutils only registers a callback to print to the screen. But the rclcpp layer than registers additional callbacks to send the logs to disk and to /rosout. Thus, no matter whether you are calling the RCUTILS log macros or the RCLCPP ones, they should in theory go out to all registered places.
But I can indeed confirm that this is not happening with the RCUTILS macros, either with the LifecycleNode or with a regular Node, for that matter. Something about the logging subsystem isn't working how I expect.
So the logging subsystem uses a dependency-injection type of model. In particular, what happens is that the rcutils_logging APIs allow the registration of an arbitrary number of callbacks, and when a log message comes in, it calls each of those callbacks in turn.
Actually, after looking at this further, this is wrong. rcutils only has room for a single callback. The multiple callback solution is implemented in the rcl layer, so it will indeed only work if you are using the RCLCPP macros. That seems like something of a design problem, and it would be nice to move that into the rcutils layer. But for now, the easier solution is to change the Lifecycle code to just use the RCLCPP macros. See #2233 for the fix.
Activity
clalancette commentedon Jun 30, 2023
So the logging subsystem uses a dependency-injection type of model. In particular, what happens is that the
rcutils_loggingAPIs allow the registration of an arbitrary number of callbacks, and when a log message comes in, it calls each of those callbacks in turn. By default,rcutilsonly registers a callback to print to the screen. But therclcpplayer than registers additional callbacks to send the logs to disk and to/rosout. Thus, no matter whether you are calling theRCUTILSlog macros or theRCLCPPones, they should in theory go out to all registered places.But I can indeed confirm that this is not happening with the
RCUTILSmacros, either with theLifecycleNodeor with a regularNode, for that matter. Something about the logging subsystem isn't working how I expect.clalancette commentedon Jul 6, 2023
Actually, after looking at this further, this is wrong.
rcutilsonly has room for a single callback. The multiple callback solution is implemented in thercllayer, so it will indeed only work if you are using theRCLCPPmacros. That seems like something of a design problem, and it would be nice to move that into thercutilslayer. But for now, the easier solution is to change the Lifecycle code to just use theRCLCPPmacros. See #2233 for the fix.tonynajjar commentedon Jul 6, 2023
Thanks a lot for the quick fix! When I find some time, probably early next week, I'll try to backport the fix to Humble locally and test it out