| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- commit 782b563a586b1b7fa93a383086b8b292f23021f6
- Author: pan-wang <[email protected]>
- Date: Wed Feb 21 14:08:26 2018 -0800
- fixing empty logfile name in event log (#602)
-
- Empty log file path was logged as we reset the stru too earlier. Changing the code order
- diff --git a/src/CommonLib/resources.h b/src/CommonLib/resources.h
- index 26606446252..c093e8bf066 100644
- --- a/src/CommonLib/resources.h
- +++ b/src/CommonLib/resources.h
- @@ -13,7 +13,7 @@
- #define ASPNETCORE_EVENT_PROCESS_START_SUCCESS_MSG L"Application '%s' started process '%d' successfully and is listening on port '%d'."
- #define ASPNETCORE_EVENT_RAPID_FAIL_COUNT_EXCEEDED_MSG L"Maximum rapid fail count per minute of '%d' exceeded."
- #define ASPNETCORE_EVENT_PROCESS_START_ERROR_MSG L"Application '%s' with physical root '%s' failed to start process with commandline '%s' at stage '%s', ErrorCode = '0x%x', retryCounter '%d'."
- -#define ASPNETCORE_EVENT_PROCESS_START_FAILURE_MSG L"Application '%s' with physical root '%s' failed to start process with commandline '%s'with multiple retries. The last try of listening port is '%d'. See pervious warnings for details."
- +#define ASPNETCORE_EVENT_PROCESS_START_FAILURE_MSG L"Application '%s' with physical root '%s' failed to start process with commandline '%s' with multiple retries. The last try of listening port is '%d'. See pervious warnings for details."
- #define ASPNETCORE_EVENT_PROCESS_START_STATUS_ERROR_MSG L"Application '%s' with physical root '%s' failed to start process with commandline '%s' , ErrorCode = '0x%x', processStatus '%d'."
- #define ASPNETCORE_EVENT_PROCESS_START_PORTSETUP_ERROR_MSG L"Application '%s' with physical root '%s' failed to choose listen port '%d' given port rang '%d - %d', EorrorCode = '0x%x'. If environment variable 'ASPNETCORE_PORT' was set, try removing it such that a random port is selected instead."
- #define ASPNETCORE_EVENT_PROCESS_START_WRONGPORT_ERROR_MSG L"Application '%s' with physical root '%s' created process with commandline '%s' but failed to listen on the given port '%d'"
- diff --git a/src/RequestHandler/outofprocess/serverprocess.cxx b/src/RequestHandler/outofprocess/serverprocess.cxx
- index 431cc41a3f1..08ef028aef2 100644
- --- a/src/RequestHandler/outofprocess/serverprocess.cxx
- +++ b/src/RequestHandler/outofprocess/serverprocess.cxx
- @@ -926,6 +926,7 @@ Finished:
- if (SUCCEEDED(strEventMsg.SafeSnwprintf(
- ASPNETCORE_EVENT_PROCESS_START_FAILURE_MSG,
- m_struAppFullPath.QueryStr(),
- + m_struPhysicalPath.QueryStr(),
- m_struCommandLine.QueryStr(),
- m_dwPort)))
- {
- @@ -998,12 +999,6 @@ SERVER_PROCESS::SetupStdHandles(
- goto Finished;
- }
-
- - hr = UTILITY::EnsureDirectoryPathExist(struPath.QueryStr());
- - if (FAILED(hr))
- - {
- - goto Finished;
- - }
- -
- GetSystemTime(&systemTime);
- hr = m_struFullLogFile.SafeSnwprintf(L"%s_%d%02d%02d%02d%02d%02d_%d.log",
- struPath.QueryStr(),
- @@ -1019,6 +1014,12 @@ SERVER_PROCESS::SetupStdHandles(
- goto Finished;
- }
-
- + hr = UTILITY::EnsureDirectoryPathExist(struPath.QueryStr());
- + if (FAILED(hr))
- + {
- + goto Finished;
- + }
- +
- saAttr.nLength = sizeof(SECURITY_ATTRIBUTES);
- saAttr.bInheritHandle = TRUE;
- saAttr.lpSecurityDescriptor = NULL;
- @@ -1057,8 +1058,6 @@ SERVER_PROCESS::SetupStdHandles(
- Finished:
- if (FAILED(hr))
- {
- - // The log file was not created yet in case of failure. No need to clean it
- - m_struFullLogFile.Reset();
- pStartupInfo->dwFlags = STARTF_USESTDHANDLES;
- pStartupInfo->hStdInput = INVALID_HANDLE_VALUE;
- pStartupInfo->hStdError = INVALID_HANDLE_VALUE;
- @@ -1070,7 +1069,7 @@ Finished:
- STRU strEventMsg;
- if (SUCCEEDED(strEventMsg.SafeSnwprintf(
- ASPNETCORE_EVENT_INVALID_STDOUT_LOG_FILE_MSG,
- - m_struFullLogFile.QueryStr(),
- + m_struFullLogFile.IsEmpty()? m_struLogFile.QueryStr() : m_struFullLogFile.QueryStr(),
- hr)))
- {
- UTILITY::LogEvent(g_hEventLog,
- @@ -1079,6 +1078,8 @@ Finished:
- strEventMsg.QueryStr());
- }
- }
- + // The log file was not created yet in case of failure. No need to clean it
- + m_struFullLogFile.Reset();
- }
- return hr;
- }
|