roscpp log grows forever

asked 2019-05-23 02:38:25 -0600

knxa gravatar image

When logging with ROS_INFO (and friends) the logged lines seems to be printed to stdout and then piped to a log file named <nodename>-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?

edit retag flag offensive close merge delete

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).

gvdhoorn gravatar image gvdhoorn  ( 2019-05-23 03:22:04 -0600 )edit

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

knxa gravatar image knxa  ( 2019-05-27 20:22:47 -0600 )edit

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.

gvdhoorn gravatar image gvdhoorn  ( 2019-05-28 02:14:37 -0600 )edit