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 <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?
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).
Does Linux allow any tricks to somehow manually roll the log without breaking the pipe that is writing to the file?
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 forN
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 asyslog
appender (as I wrote in #q229966). If it can, at that point you could use whatever other infrastructure can deal with syslogs.