There are two good options:
Use the Windows Event Log. You can easily create your own log for your application (if you expect to generate a lot of messages), or you can just add the messages to the standard logs (if you expect to generate only a few, occasional messages).
Since this is a built-in feature, any technical person is going to know about it and be able to locate your log files easily. It's also very interoperable with centralized management systems.
Write to a text file saved in the Application Data directory. This is where applications are supposed to store non-user data files, since, as you mentioned, the application directory is not something you can assume write privileges to.
For a log file about stuff that is specific to a particular computer, I'd say that this is local (non-roaming) application data, so you want the Local App Data folder. I'm sure that there is a Qt wrapper for this, but in Win32, you would call the
SHGetKnownFolderPath
function, specifying theKNOWNFOLDERID
valueFOLDERID_LocalAppData
.Remember that this function allocates memory to store the returned string—you must free it with a call to
CoTaskMemFree
when you are finished.Sample code:
// Retrieve the path to the local App Data folder. wchar_t* pszPath = 0; SHGetKnownFolderPath(FOLDERID_LocalAppData, 0, NULL, &pszPath); // Make a copy of that path. std::wstring path(pszPath); // Free the memory now, so you don't forget! CoTaskMemFree(static_cast<void*>(pszPath));