Robotics StackExchange | Archived questions

Why is my node not logging to a file?

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 ROSHOME or ROSLOG_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

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

Asked by grouchy on 2020-07-11 02:38:25 UTC

Comments

I think its something to do with roslaunch or rosconsole I have a similar issue here https://answers.ros.org/question/366408/roscpp-error-logs-never-get-written-to-node-logfile/

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.

Asked by H+ on 2020-11-26 16:17:04 UTC

Answers