Robotics StackExchange | Archived questions

roscpp log grows forever

When logging with ROS_INFO (and friends) the logged lines seems to be printed to stdout and then piped to a log file named -N-stdout.

In a long running ROS session, I have the challenge that these files keep growing, since it is just stdout that is being piped to the file. This is not acceptable in my setup.

What are my options to circumvent this?

Asked by knxa on 2019-05-23 02:38:25 UTC

Comments

I'm not entirely certain, but I believe the situation hasn't changed since #q229966. The PR linked there hasn't been merged (for good reasons actually).

Asked by gvdhoorn on 2019-05-23 03:22:04 UTC

Does Linux allow any tricks to somehow manually roll the log without breaking the pipe that is writing to the file?

Asked by knxa on 2019-05-27 20:22:47 UTC

I've never tried it, but perhaps you could use logrotate with the copytruncate directive. If the logs are appended to, this could potentially help, but I'm really not sure.

The fact that there are at least N logfiles for N nodes doesn't make this easy to implement though.

Another thing to try perhaps would be to see whether log4cxx could be configured to use a syslog appender (as I wrote in #q229966). If it can, at that point you could use whatever other infrastructure can deal with syslogs.

Asked by gvdhoorn on 2019-05-28 02:14:37 UTC

Answers