IISIntegration 818 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. commit 782b563a586b1b7fa93a383086b8b292f23021f6
  2. Author: pan-wang <[email protected]>
  3. Date: Wed Feb 21 14:08:26 2018 -0800
  4. fixing empty logfile name in event log (#602)
  5. Empty log file path was logged as we reset the stru too earlier. Changing the code order
  6. diff --git a/src/CommonLib/resources.h b/src/CommonLib/resources.h
  7. index 26606446252..c093e8bf066 100644
  8. --- a/src/CommonLib/resources.h
  9. +++ b/src/CommonLib/resources.h
  10. @@ -13,7 +13,7 @@
  11. #define ASPNETCORE_EVENT_PROCESS_START_SUCCESS_MSG L"Application '%s' started process '%d' successfully and is listening on port '%d'."
  12. #define ASPNETCORE_EVENT_RAPID_FAIL_COUNT_EXCEEDED_MSG L"Maximum rapid fail count per minute of '%d' exceeded."
  13. #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'."
  14. -#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."
  15. +#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."
  16. #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'."
  17. #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."
  18. #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'"
  19. diff --git a/src/RequestHandler/outofprocess/serverprocess.cxx b/src/RequestHandler/outofprocess/serverprocess.cxx
  20. index 431cc41a3f1..08ef028aef2 100644
  21. --- a/src/RequestHandler/outofprocess/serverprocess.cxx
  22. +++ b/src/RequestHandler/outofprocess/serverprocess.cxx
  23. @@ -926,6 +926,7 @@ Finished:
  24. if (SUCCEEDED(strEventMsg.SafeSnwprintf(
  25. ASPNETCORE_EVENT_PROCESS_START_FAILURE_MSG,
  26. m_struAppFullPath.QueryStr(),
  27. + m_struPhysicalPath.QueryStr(),
  28. m_struCommandLine.QueryStr(),
  29. m_dwPort)))
  30. {
  31. @@ -998,12 +999,6 @@ SERVER_PROCESS::SetupStdHandles(
  32. goto Finished;
  33. }
  34. - hr = UTILITY::EnsureDirectoryPathExist(struPath.QueryStr());
  35. - if (FAILED(hr))
  36. - {
  37. - goto Finished;
  38. - }
  39. -
  40. GetSystemTime(&systemTime);
  41. hr = m_struFullLogFile.SafeSnwprintf(L"%s_%d%02d%02d%02d%02d%02d_%d.log",
  42. struPath.QueryStr(),
  43. @@ -1019,6 +1014,12 @@ SERVER_PROCESS::SetupStdHandles(
  44. goto Finished;
  45. }
  46. + hr = UTILITY::EnsureDirectoryPathExist(struPath.QueryStr());
  47. + if (FAILED(hr))
  48. + {
  49. + goto Finished;
  50. + }
  51. +
  52. saAttr.nLength = sizeof(SECURITY_ATTRIBUTES);
  53. saAttr.bInheritHandle = TRUE;
  54. saAttr.lpSecurityDescriptor = NULL;
  55. @@ -1057,8 +1058,6 @@ SERVER_PROCESS::SetupStdHandles(
  56. Finished:
  57. if (FAILED(hr))
  58. {
  59. - // The log file was not created yet in case of failure. No need to clean it
  60. - m_struFullLogFile.Reset();
  61. pStartupInfo->dwFlags = STARTF_USESTDHANDLES;
  62. pStartupInfo->hStdInput = INVALID_HANDLE_VALUE;
  63. pStartupInfo->hStdError = INVALID_HANDLE_VALUE;
  64. @@ -1070,7 +1069,7 @@ Finished:
  65. STRU strEventMsg;
  66. if (SUCCEEDED(strEventMsg.SafeSnwprintf(
  67. ASPNETCORE_EVENT_INVALID_STDOUT_LOG_FILE_MSG,
  68. - m_struFullLogFile.QueryStr(),
  69. + m_struFullLogFile.IsEmpty()? m_struLogFile.QueryStr() : m_struFullLogFile.QueryStr(),
  70. hr)))
  71. {
  72. UTILITY::LogEvent(g_hEventLog,
  73. @@ -1079,6 +1078,8 @@ Finished:
  74. strEventMsg.QueryStr());
  75. }
  76. }
  77. + // The log file was not created yet in case of failure. No need to clean it
  78. + m_struFullLogFile.Reset();
  79. }
  80. return hr;
  81. }