[Interest] using QTemporaryFile for post-mortem debug logfiles?

Konrad Rosenbaum konrad at silmor.de
Mon May 22 13:21:05 CEST 2017


On Sun, May 21, 2017 14:20, René J. V. Bertin wrote:
> Konstantin Tokarev wrote:
>> Don't use QTemporaryFile. Use regular files with consistent naming, e.g.
>> log-$date, remove logs older than some date at the start of your program
> That's another solution, thanks. I'd probably keep only a single old
> logfile and
> thus spare myself the hassle of doing date/time comparisons.

>From my experience I'd recommend you go the long route and actually
implement the date/time comparison(*). For one: problems have the bad
habit of forcing you to restart the application multiple times, so you'll
lose at least the first instance of the problem. For another: if your user
starts multiple instances of the same application you'll lose logs of
instances that are still running.

(*) date is usually enough for the comparison; you don't even have to
parse the file names, just look at the time of the last file change


More information about the Interest mailing list