[Interest] using QTemporaryFile for post-mortem debug logfiles?
René J.V. Bertin
rjvbertin at gmail.com
Mon May 22 16:27:31 CEST 2017
On Monday May 22 2017 15:08:34 Konrad Rosenbaum wrote:
>This only works if the problem is a crash. Only a minor percentage of
That's specifically the point here: post-mortem debug information.
>> I'm curious though, why does my QTemporaryFile trick to auto-remove only
>> empty files not work as expected?
>Because the QTemporaryFile is not about a file being empty, its about a
>file being temporary. It creates a normal file under a unique name and
>normally deletes it when it is closed. This happens so you can safely use
That doesn't answer my question, which is why setAutoRemove(true) has no effect when I call it just before closing the temp. file.
Maybe checking qTempFile->size() or even qTempFile->pos() against 0 doesn't give me the expected result, but then the why question moves to that fact.
> In either case QTemporaryFile does
>not care a rat's furry backside about the content or lack of content of
>the file... ;-)
And well it shouldn't, if the file is empty ;)
>PS: the time that it took us to discuss the pros and cons of a proper log
>rotation scheme is not so much smaller than the time you need to implement
Sure, that's often the case ... but just maybe now I'll be learning something 8-)
More information about the Interest