I have some Java executable (jar) that is run my some shell script from a cron job once every night. That executable does not print log statements "as usual" just by printing them out in a sequential manner like line after line (print after print), but while it processes its data its printing a single line with status data and then "overwrite" or "update" just that single line over and over again, until its done with this part of processing.
A common program would output something line this:
Program XYZ started..<cr+lf> processing 1<cr+lf> processing 2<cr+lf> processing 3<cr+lf> im done<cr+lf>
Simple! I can easily redirect its output to a file and I'm done.
But the program I will have to deal with does it more like this:
Program XYZ started..<cr+lf> processing 1<cr> processing 1 - part a<cr> processing 1 - part b<cr> processing 1 - part c<cr> processing 1 - part d<cr> <cr+lf> processing 2<cr> processing 2 - part a<cr> processing 2 - part b<cr> processing 2 - part c<cr> processing 2 - part d<cr> <cr+lf> processing 3<cr+lf> im done<cr+lf>
but much more intensive than I showed here. So it just not always overwrite status lines, but does it a lot while processing. So just redirecting or appending its output to a log file does not seem to make a lot of sense here, since it will just clutter the log file with millions of screen-updates that can not be viewed and understood that easily by humans.
So my question is: is there a way or tool for programs that may behave like that to "log" or maybe "screenshot every 30 seconds" their output to a log file?