Log rotation in ros
I am looking for a clean and standard way to have a log rotation in my program. Through this answer I found this PR that mentioned this feature but currently has not merged and does not seem have a plan to merge in the near future. Also by looking at the answer I tried to work with logrotate and with some script like this I wrote a script to rotate my logs (I had to use copytruncate) but there is a annoying problem with this approach.
As this answer mentions there is a conflict between logrotate and log4j, log4j track the position of file and when we truncate it for being compatible unix system adds some null characters before the current position of log and finally we get the same file size and rotation does not mean anything.
I think log rotation is an important feature for a program in a medium scale and above, and I wonder how some big real robot softwares implement this feature and is it possible to run a big project without this feature, I have a limited resource but I hope to able to keep all information that I log during runtime.
Can someone suggest me a solution to this and explain why does not this feature exist in ros log (am I wrong about importance of this feature or not)?
Could anyone suggest me a starting point for solving this problem?
Hi Mohsen, have you solved this problem? I'm also facing it.
No I`m still looking for a proper solution of it, currently we just try to log as much as we hope not floating.