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

Filtering the log files from log directories [~/.ros/log and ~/.ros/logs]

asked 2020-03-09 08:53:49 -0500

sosoup gravatar image

Filtering the log files for one exact session does not seem to be so trivial. There are in fact two of the log directories:

  • ~/.ros/log, which seems to contain one directory per session, but not the node-specific logs
  • ~/.ros/logs, which contains all node and topic-specific logs

Please correct me if I am wrong.

Now, if ~/.ros/logs does contain relevant information, how to FILTER only the logs related to the last session? Thanks in advance!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2020-03-09 10:30:38 -0500

ct2034 gravatar image

Generally, logs will be created in ~/.ros/log. Each of the folders in there corresponds to one session. (each time you started a roscore, either manually or with roslaunch) At the start of the session, the path will be displayed which will look something like this:

... logging to /home/USER/.ros/log/ad10d67c-6219-11ea-a8a8-207918a17840/roslaunch-host-2444.log

In this folder, (here ~/.ros/log/ad10d67c-6219-11ea-a8a8-207918a17840) every node will get a file produced by the logging macros in the sources. But there will also be a floder ~/.ros/log/latest, containing the logs from the last session. It is actually a symlink, you can use it to check, which one was the last session with ls -l ~/.ros/log/latest.

edit flag offensive delete link more



Hi, juste to be as accurate as possible :

  • logs are stored in $ROS_HOME/log (default is .ros folder in your home directory)

  • if you want to modify tis path, set $ROS_LOG_DIR env. var.

  • each time you start a new master, a new folder is created. FOlder name is a UUID randomly generated. Not particularly user friendly... but ROS also symlink the current (or last) logs directory as

If you don't see what you want in there, 2 hints :

  • I can't remember the default, but I think you have to set output="log" attribute when declaring your node in your launchfile

  • You can set $ROSCONSOLE_CONFIG_FILE and $ROSCONSOLE_FORMAT env. variables to match your needs (see ros wiki

luchko gravatar image luchko  ( 2020-03-09 10:47:50 -0500 )edit

Thanks @ct2034 and @luchko. But my issue is still not clear. As I have mentioned there are couple of directories:

  1. ${ROS_LOG_DIR}/log
  2. ${ROS_LOG_DIR}/logs

While the explanation for /log directory is clear. What the /logs directory contains?

sosoup gravatar image sosoup  ( 2020-03-09 11:34:35 -0500 )edit

I dont think i have ever seen a ${ROS_LOG_DIR}/logs dir. what does it contain?

ct2034 gravatar image ct2034  ( 2020-03-09 11:40:03 -0500 )edit

A quick look at the $ echo $ROS_LOG_DIR gives me ~/.ros/logs which would mean that this is the default log directory. However, I could see another ~/.ros/log directory along side and that might be because, (as @luchko also mentioned) of the ROS launch attribute for logging, output="log|screen", if 'log', the stdout/stderr output will be sent to a log file in $ROS_HOME/log. ROS launch node tag.

sosoup gravatar image sosoup  ( 2020-03-10 04:46:37 -0500 )edit

does this answer your question?

ct2034 gravatar image ct2034  ( 2020-03-11 07:34:18 -0500 )edit

Question Tools

1 follower


Asked: 2020-03-09 08:53:49 -0500

Seen: 1,151 times

Last updated: Mar 09 '20