stefanadelbert
22nd July 2010, 03:50
I'm writing a Qt Application for Windows 7 and I'm currently adding a relatively crude log-to-file mechanism.
I'm using a QTextStream linked to a QFile (QIODevice::WriteOnly | QIODevice::Text) to write data to file
I'm installing a QMsgHandler using qInstallMsgHandler which appends a timestamp to the message and then writes it to file using the QTextStream
I'm planning on having the logging running in a separate thread, but I'll get to that later
For the moment, I'm stuck on where I should actually create the log file under Windows 7. I'm developing in VS 2008 and using Windows Installer to create installation packages. My Qt application installs under C:\Program Files\..., which works fine for running the application without creating the log file. But Windows is not allowing my application me to create the log file in C:\Program Files, unless I run the application as Administrator.
Is there standard pattern for this? Does Windows prefer the log files be written somewhere else (an equivalent of Linux's /var/log)?
Any help appreciated.
I'm using a QTextStream linked to a QFile (QIODevice::WriteOnly | QIODevice::Text) to write data to file
I'm installing a QMsgHandler using qInstallMsgHandler which appends a timestamp to the message and then writes it to file using the QTextStream
I'm planning on having the logging running in a separate thread, but I'll get to that later
For the moment, I'm stuck on where I should actually create the log file under Windows 7. I'm developing in VS 2008 and using Windows Installer to create installation packages. My Qt application installs under C:\Program Files\..., which works fine for running the application without creating the log file. But Windows is not allowing my application me to create the log file in C:\Program Files, unless I run the application as Administrator.
Is there standard pattern for this? Does Windows prefer the log files be written somewhere else (an equivalent of Linux's /var/log)?
Any help appreciated.