Ask Your Question

Roscpp error logs never get written to node logfile

asked 2020-11-26 01:01:20 -0500

H+ gravatar image

updated 2020-11-26 01:09:23 -0500

This is the code in my roscpp node:

#include "ros/ros.h"                                                                                                                                                                                        
#include <ros/console.h>                                                                                                                                                                                     
int main( int argc, char * argv[]) {  
    ros::init(argc, argv, "test_node");                         
    sleep( 5 );                                                                                                                                                                                                
    ROS_ERROR( "BAR" );                                                                                                                                                                                     
    ROS_INFO( "FOO" );                                                                                                                                                                                   
    sleep( 5 );                                                                                                                                                                                                                                                                                                                                                                      }

My launch file is simple:

    <node pkg="test_node" type="test_node" name="test_node"> </node>

When I run:

roslaunch test_node test_node.launch

I get the following output on the terminal:

process[test_node-1]: started with pid [25327]
[ERROR] [1606373695.024750165]: BAR
[test_node-1] process has finished cleanly
log file: /home/me/.ros/log/acd2a32a-2f9b-11eb-9f56-9cfce822015a/test_node-1*.log
all processes on machine have died, roslaunch will exit
shutting down processing monitor...
... shutting down processing monitor complete

When I look in the node log file in /home/me/.ros/log/latest/test_node-1-stdout.log

I only see the INFO log "FOO" but I don't see the ERROR log "BAR".


I've tried this a hundred different ways considering process buffers being flushed etc... and boiled it down to this.

Even if instead of exiting I ros::spin() and let it run and then ctrl-c I still get the INFO but no ERROR in the log file.

The fact that the info log gets there and the error doesn't is driving me mad.

I've tried redirecting stderr to stdout for the roslaunch process - no luck.

Flushing makes no difference.

How the node exits (assert, graceful) no difference.

I think there is a bug in roslaunch or rosconcole.

This is on ROS melodic on ubuntu 18.04

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2020-11-27 12:33:23 -0500

H+ gravatar image

I think the answer is here

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2020-11-26 01:01:20 -0500

Seen: 137 times

Last updated: Nov 27 '20