Why does (local) logging using ROS_* not work after a node shutdown was triggered? [closed]

asked 2015-08-27 03:04:08 -0600

anonymous user



I would like to know why logging using the ROS_* calls stops working after a shutdown was requested (ctrl+c, requestShutdown, ...). The docu is clearly mentioning that after the shutdown() method returns no network communication is available. In other words when the typical while (nh.ok) { ... } loop returns. This will prevent any ROS_* call being sent to a remote console (rqt_console etc.).

I am interested in local logging into the console of the node. See this little example:

int main(int argc, char** argv) {
    ros::init(argc, argv, "example");
    ros::NodeHandle nh;

    // do some serious initializations
    ROS_INFO("everything is setup.");

    while (nh.ok()) {

    // ROS_* call do not work here anymore
    ROS_INFO("I will never make it to console");
    std::cerr << "but I will" << std::endl;

    return 0;

I expected the logging calls after the loop to at least print something on the console. Is there any way to make this happen? I would like to cover the process of destructing objects with debug/info output without switching to std::cerr.

Regards, Hannes

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by tfoote
close date 2021-07-12 09:36:26.637146