File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed
AspNetCoreModuleV2/CommonLib
IIS/test/Common.FunctionalTests Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -123,7 +123,7 @@ void SetDebugFlags(const std::wstring &debugValue)
123123 }
124124}
125125
126- bool CreateDebugLogFile (const std::wstring &debugOutputFile)
126+ bool CreateDebugLogFile (const std::filesystem::path &debugOutputFile)
127127{
128128 try
129129 {
@@ -140,6 +140,11 @@ bool CreateDebugLogFile(const std::wstring &debugOutputFile)
140140 CloseHandle (g_logFile);
141141 g_logFile = INVALID_HANDLE_VALUE;
142142 }
143+
144+ // ignore errors
145+ std::error_code ec;
146+ create_directories (debugOutputFile.parent_path (), ec);
147+
143148 g_logFile = CreateFileW (debugOutputFile.c_str (),
144149 (GENERIC_READ | GENERIC_WRITE),
145150 (FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE),
@@ -348,13 +353,13 @@ DebugPrintW(
348353 WORD eventType;
349354 switch (dwFlag)
350355 {
351- case ASPNETCORE_DEBUG_FLAG_ERROR:
356+ case ASPNETCORE_DEBUG_FLAG_ERROR:
352357 eventType = EVENTLOG_ERROR_TYPE;
353358 break ;
354- case ASPNETCORE_DEBUG_FLAG_WARNING:
359+ case ASPNETCORE_DEBUG_FLAG_WARNING:
355360 eventType = EVENTLOG_WARNING_TYPE;
356361 break ;
357- default :
362+ default :
358363 eventType = EVENTLOG_INFORMATION_TYPE;
359364 break ;
360365 }
Original file line number Diff line number Diff line change @@ -85,17 +85,18 @@ public async Task InvalidFilePathForLogs_ServerStillRuns(TestVariant variant)
8585
8686 [ ConditionalTheory ]
8787 [ MemberData ( nameof ( TestVariants ) ) ]
88+ [ RequiresNewShim ]
8889 public async Task StartupMessagesAreLoggedIntoDebugLogFile ( TestVariant variant )
8990 {
9091 var deploymentParameters = _fixture . GetBaseDeploymentParameters ( variant , publish : true ) ;
9192 deploymentParameters . HandlerSettings [ "debugLevel" ] = "file" ;
92- deploymentParameters . HandlerSettings [ "debugFile" ] = "debug.txt" ;
93+ deploymentParameters . HandlerSettings [ "debugFile" ] = "subdirectory \\ debug.txt" ;
9394
9495 var deploymentResult = await DeployAsync ( deploymentParameters ) ;
9596
9697 await deploymentResult . HttpClient . GetAsync ( "/" ) ;
9798
98- AssertLogs ( Path . Combine ( deploymentResult . ContentRoot , "debug.txt" ) ) ;
99+ AssertLogs ( Path . Combine ( deploymentResult . ContentRoot , "subdirectory" , " debug.txt") ) ;
99100 }
100101
101102 [ ConditionalTheory ]
You can’t perform that action at this time.
0 commit comments