ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
3

ros log: named and stderr

asked 2017-01-03 12:38:03 -0500

roboticom314 gravatar image

I'm trying to better understand the ROS console and logging. I have two issues -- named logs and stderr logs -- that might have a related root cause.

  • OS: Ubuntu 14.04.4
  • ROS release: indigo

Named Logs

I would like to use a named stream but I never see the named log file in ~/.ros/log as I would expect. Instead I see nodename-2-stdout.log. The documentation for NAMED logs is here but I'm not sure if I'm missing something or it has changed.

I still see the INFO and DEBUG prints in nodename-2-stdout.log from ROS_DEBUG_STREAM_NAMED or ROS_INFO_STREAM_NAMED but no mention anywhere of the name I used. Are these NAMED, INFO and DEBUG prints supposed to end up in a named log file in ~/.ros/log?

STDERR

The Logging Output Documentation describes stderr and stdout to the log file according to the table and text. I only see a node log file appended with stdout.log. stderr (e.g. ERROR) seems to be printed to my rosout.log. Should I have a nodename.log containing stderr and stdout or is my setup somehow configured to only output the node log with stdout output?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2017-01-03 18:08:29 -0500

ahendrix gravatar image

Using the _NAMED macros create a named log4cxx logger, which adds the name to each log message on rosout and allows you to set the log level for those messages separately, but it's using the same appender and appending to the same log file by default.

I haven't done it myself, but if you can figure out how to configure log4cxx by following the rosconsole configuration you can redirect the output for your named logger to a separate file.

I'm not sure why you're not seeing a stderr log; I believe those are set up by roslaunch, so it may be related to where you're sending the node output from roslaunch. (output="log" vs output="screen") (if you're not using roslaunch, you won't have a stderr log at all)

edit flag offensive delete link more

Comments

I tried output="log" and still don't see the stderr logs. In fact, I can't remember ever seeing stderr logs even with launch files. Any other thoughts there?

roboticom314 gravatar image roboticom314  ( 2017-01-05 12:16:23 -0500 )edit

I thought I'd seen stderr written to logs, but I don't have any around, so now I'm not sure that roslaunch actually sends stderr to a separate log at all.

ahendrix gravatar image ahendrix  ( 2017-01-05 12:42:30 -0500 )edit

Note that the logging documentation that you're referring to says that log messages go to stderr, and in POSIX terminology, stdout and stderr traditionally go to the terminal, not a log. See https://en.wikipedia.org/wiki/Standar... (stdout goes to a log because roslaunch redirects it there)

ahendrix gravatar image ahendrix  ( 2017-01-05 12:44:35 -0500 )edit

I have seen in the past mentions of stderr items being written to a log in ~/.ros/log that never seems to exist. I think there is the idea that stderr could be written to a log but there's some implementation detail that's missing.

roboticom314 gravatar image roboticom314  ( 2017-01-06 09:35:47 -0500 )edit

This seems related to my issue of not seeing ROS_ERROR calls being logged to a log file. I see a stdout log for each node but no stderr log. All ROS_ERROR output goes to the terminal. I am running Kinetic on a Debian Jessie OS.

CCGreg gravatar image CCGreg  ( 2018-02-15 12:54:05 -0500 )edit

Has anyone ever figured out how to get stderr to go to a log file? Right now I'm defaulting to redirecting the output of roslaunch with 2>stderr.log but would be nice if there was an automatic / standardized way of getting it included in the node's log file

davrsky gravatar image davrsky  ( 2018-02-16 14:42:07 -0500 )edit
1

For the stderr logging issue, a hacky way of getting it to work is to make the following change to /opt/ros/<ROS_DISTRO>/lib/python<2.7 or 3.*>/dist-packages/roslaunch/nodeprocess.py:

  1. Un-indent line 250: logfileerr = open(errf, mode)
  2. Remove line 249: if is_child_mode():

Now you when you run nodes you should see the <node_name>-stderr.log file in you log directory.

JeremyRoy gravatar image JeremyRoy  ( 2021-12-06 13:21:00 -0500 )edit
0

answered 2020-04-23 02:30:42 -0500

berry0511 gravatar image
edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2017-01-03 12:38:03 -0500

Seen: 4,149 times

Last updated: Apr 23 '20