We have a c++ application (console) that runs on windows and unix. This application used output files to output verbose log files of system calls/prints/etc. The prblem is, that in certain occasion we might get signal 11/2 after new features are added.
Now whenever, that happenes, we do not get 'almost complete' information from log files to track down the origin of the bug/problem since the output files are not closed properly when signal 11 occurs. (it's only partial or zero sized)
We considered adding a flush command after every fprintf line print. Q :
- Is that considered a good practive ?
- does fflush works well on windows platfrom ?
- any thoughts/other methods to keep log files while system might crash unexpectedly ?