summaryrefslogtreecommitdiff
path: root/src/VBox/Main/src-server/win/svcmain.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/VBox/Main/src-server/win/svcmain.cpp')
-rw-r--r--src/VBox/Main/src-server/win/svcmain.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/VBox/Main/src-server/win/svcmain.cpp b/src/VBox/Main/src-server/win/svcmain.cpp
index 111c2dd4..5e2c251b 100644
--- a/src/VBox/Main/src-server/win/svcmain.cpp
+++ b/src/VBox/Main/src-server/win/svcmain.cpp
@@ -327,19 +327,26 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPSTR /*lpC
* registering/unregistering or calling the helper functionality. */
if (fRun)
{
+ /** @todo Merge this code with server.cpp (use Logging.cpp?). */
+ char szLogFile[RTPATH_MAX];
if (!pszLogFile)
{
- char szLogFile[RTPATH_MAX];
vrc = com::GetVBoxUserHomeDirectory(szLogFile, sizeof(szLogFile));
if (RT_SUCCESS(vrc))
vrc = RTPathAppend(szLogFile, sizeof(szLogFile), "VBoxSVC.log");
- if (RT_SUCCESS(vrc))
- pszLogFile = RTStrDup(szLogFile);
}
+ else
+ {
+ if (!RTStrPrintf(szLogFile, sizeof(szLogFile), "%s", pszLogFile))
+ vrc = VERR_NO_MEMORY;
+ }
+ if (RT_FAILURE(vrc))
+ return RTMsgErrorExit(RTEXITCODE_FAILURE, "failed to create logging file name, rc=%Rrc", vrc);
+
char szError[RTPATH_MAX + 128];
- vrc = com::VBoxLogRelCreate("COM Server", pszLogFile,
+ vrc = com::VBoxLogRelCreate("COM Server", szLogFile,
RTLOGFLAGS_PREFIX_THREAD | RTLOGFLAGS_PREFIX_TIME_PROG,
- "all", "VBOXSVC_RELEASE_LOG",
+ VBOXSVC_LOG_DEFAULT, "VBOXSVC_RELEASE_LOG",
RTLOGDEST_FILE, UINT32_MAX /* cMaxEntriesPerGroup */,
cHistory, uHistoryFileTime, uHistoryFileSize,
szError, sizeof(szError));