Skip to content

Commit ccbd295

Browse files
Add error details to RunFromPackage failure log (#9094)
* add file contents to log * pr feedback * Update release_notes.md * consolidate log statements
1 parent 9b32946 commit ccbd295

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

release_notes.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
- Update custom handlers to support trigger return values (#8874)
1515
- Send Workerwarmup request to warm up the worker code path before specialization (#9018)
1616
- Update PowerShell Worker 7.2 to 4.0.2673 [Release Note](https://github.com/Azure/azure-functions-powershell-worker/releases/tag/v4.0.2673)
17+
- Add error details to RunFromPackage failure log (#9094)
1718

18-
**Release sprint:** Sprint 138
19-
[ [bugs](https://github.com/Azure/azure-functions-host/issues?q=is%3Aissue+milestone%3A%22Functions+Sprint+138%22+label%3Abug+is%3Aclosed) | [features](https://github.com/Azure/azure-functions-host/issues?q=is%3Aissue+milestone%3A%22Functions+Sprint+138%22+label%3Afeature+is%3Aclosed) ]
19+
**Release sprint:** Sprint 139
20+
[ [bugs](https://github.com/Azure/azure-functions-host/issues?q=is%3Aissue+milestone%3A%22Functions+Sprint+139%22+label%3Abug+is%3Aclosed) | [features](https://github.com/Azure/azure-functions-host/issues?q=is%3Aissue+milestone%3A%22Functions+Sprint+139%22+label%3Afeature+is%3Aclosed) ]

src/WebJobs.Script.WebHost/WebJobsScriptHostService.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,24 @@ private void CheckFileSystem()
200200
// Check for marker file indicating a zip package failure, and if found stop the application.
201201
// We never want to run with an incorrect file system.
202202
string path = Path.Combine(_applicationHostOptions.CurrentValue.ScriptPath, ScriptConstants.RunFromPackageFailedFileName);
203+
203204
if (File.Exists(path))
204205
{
205-
_logger.LogError($"Shutting down host due to presence of {path}");
206+
string errorPrefix = $"Shutting down host due to presence of {path}.";
207+
string errorSuffix = string.Empty;
208+
try
209+
{
210+
string fileContent = File.ReadAllText(path);
211+
errorSuffix = $" File content: {fileContent}";
212+
}
213+
catch (Exception ex)
214+
{
215+
errorSuffix = $" Error reading {ScriptConstants.RunFromPackageFailedFileName} file content: {ex.Message}";
216+
}
217+
finally
218+
{
219+
_logger.LogError(errorPrefix + errorSuffix);
220+
}
206221
_applicationLifetime.StopApplication();
207222
}
208223
}

0 commit comments

Comments
 (0)