Changeset 89319 in vbox for trunk/src/VBox/Frontends/VBoxAutostart
- Timestamp:
- May 27, 2021 1:38:13 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxAutostart/VBoxAutostart-win.cpp
r85121 r89319 39 39 #include <VBox/version.h> 40 40 41 #include <iprt/dir.h> 41 42 #include <iprt/env.h> 42 43 #include <iprt/errcore.h> … … 80 81 /** The service name is used for send to service main. */ 81 82 static com::Bstr g_bstrServiceName; 83 84 /** Logging parameters. */ 85 static uint32_t g_cHistory = 10; /* Enable log rotation, 10 files. */ 86 static uint32_t g_uHistoryFileTime = 0; /* No time limit, it's very low volume. */ 87 static uint64_t g_uHistoryFileSize = 100 * _1M; /* Max 100MB per file. */ 82 88 83 89 … … 289 295 AssertMsg(fRc, ("%u\n", GetLastError())); NOREF(fRc); 290 296 DeregisterEventSource(hEventLog); 297 298 /* write it to the release log too */ 299 LogRel(("%s", pszMsg)); 291 300 } 292 301 … … 979 988 static int autostartSvcWinRunIt(int argc, char **argv) 980 989 { 990 int rc; 991 981 992 LogFlowFuncEnter(); 982 993 983 994 /* 984 * Initialize release logging. 995 * Initialize release logging, do this early. This means command 996 * line options (like --logfile &c) can't be introduced to affect 997 * the log file parameters, but the user can't change them easily 998 * anyway and is better off using environment variables. 985 999 */ 986 /** @todo release logging of the system-wide service. */ 1000 do 1001 { 1002 char szLogFile[RTPATH_MAX]; 1003 rc = com::GetVBoxUserHomeDirectory(szLogFile, sizeof(szLogFile), 1004 /* :fCreateDir */ false); 1005 if (RT_FAILURE(rc)) 1006 { 1007 autostartSvcLogError("Failed to get VirtualBox user home directory: %Rrc\n", rc); 1008 break; 1009 } 1010 1011 if (!RTDirExists(szLogFile)) /* vbox user home dir */ 1012 { 1013 autostartSvcLogError("%s doesn't exist\n", szLogFile); 1014 break; 1015 } 1016 1017 rc = RTPathAppend(szLogFile, sizeof(szLogFile), "VBoxAutostart.log"); 1018 if (RT_FAILURE(rc)) 1019 { 1020 autostartSvcLogError("Failed to construct release log file name: %Rrc\n", rc); 1021 break; 1022 } 1023 1024 rc = com::VBoxLogRelCreate("Autostart", 1025 szLogFile, 1026 RTLOGFLAGS_PREFIX_THREAD 1027 | RTLOGFLAGS_PREFIX_TIME_PROG, 1028 "all", 1029 "VBOXAUTOSTART_RELEASE_LOG", 1030 RTLOGDEST_FILE, 1031 UINT32_MAX /* cMaxEntriesPerGroup */, 1032 g_cHistory, 1033 g_uHistoryFileTime, 1034 g_uHistoryFileSize, 1035 NULL); 1036 if (RT_FAILURE(rc)) 1037 autostartSvcLogError("Failed to create release log file: %Rrc\n", rc); 1038 } while (0); 1039 1040 987 1041 988 1042 /* … … 1015 1069 } 1016 1070 break; 1071 1017 1072 default: 1018 return autostartSvcDisplayGetOptError("runit", ch, &Value); 1073 /** 1074 * @todo autostartSvcLogGetOptError is useless as it 1075 * is, should be change after RTGetOptPrintError. 1076 */ 1077 return autostartSvcLogError("RTGetOpt: %Rrc\n", ch); 1019 1078 } 1020 1079 } … … 1025 1084 return RTEXITCODE_FAILURE; 1026 1085 } 1086 1087 LogRel(("Starting service %ls\n", g_bstrServiceName.raw())); 1027 1088 1028 1089 /*
Note:
See TracChangeset
for help on using the changeset viewer.