Why is my node not logging to a file?

asked 2020-07-11 02:38:25 -0500

grouchy gravatar image

The roscpp logging documentation states:

Everything enabled goes into the log file. Your node's log file will be in ~/.ros/log unless you override it with the ROS_HOME or ROS_LOG_DIR environment variables.

However when I run the following node, no logfile is created:

#include <ros/ros.h>

int main(int argc, char *argv[])
    ros::init(argc, argv, "log_test");

    ROS_INFO("Info message");
    ROS_ERROR("Error message");

    return 0;

Running with this command:

rosrun log_test log_test_node

ROS_LOG_DIR and ROS_HOME are not set, otherwise everything else is a standard ROS Noetic installation on Ubuntu 20.04. What's going on?

edit retag flag offensive close merge delete


I think its something to do with roslaunch or rosconsole I have a similar issue here https://answers.ros.org/question/3664...

The process should flush output from buffers to stdout/stderr on exit - and in my case I see that. I assume you also see the ERROR log on stderr when you run it.

But for some reason the ros process (roslaunch?) that manages the nodes stdout/stderr doesn't seem to pick it up.

H+ gravatar image H+  ( 2020-11-26 15:17:04 -0500 )edit