Conversation
There was a problem hiding this comment.
Pull request overview
This PR improves logging in HCS helper functions by addressing log truncation issues that could occur when error messages and configuration strings are lengthy. The main enhancement splits verbose logging into separate calls to preserve important diagnostic context.
Key changes:
- Modified
CreateComputeSystemto use split logging withLOG_HR_MSGfollowed byTHROW_HR_MSGto prevent truncation - Simplified error messages in several HCS operations by removing redundant "HcsWaitForOperationResult for" prefixes
| "HcsWaitForOperationResult for HcsModifyComputeSystem failed (%ls - error string: %ls)", | ||
| Configuration, | ||
| resultDocument.get()); | ||
| THROW_IF_FAILED_MSG(result, "HcsModifyComputeSystem failed (%ls - error string: %ls)", Configuration, resultDocument.get()); |
There was a problem hiding this comment.
This error message still combines both the Configuration and error string in a single log statement, which can lead to truncation of valuable context (the same issue that was addressed in CreateComputeSystem). Consider applying the same split logging pattern used in CreateComputeSystem to prevent truncation.
| THROW_IF_FAILED_MSG(result, "HcsModifyComputeSystem failed (%ls - error string: %ls)", Configuration, resultDocument.get()); | |
| if (FAILED(result)) | |
| { | |
| LOG_IF_FAILED_MSG(result, "HcsModifyComputeSystem configuration (%ls)", Configuration); | |
| THROW_IF_FAILED_MSG(result, "HcsModifyComputeSystem failed (error string: %ls)", resultDocument.get()); | |
| } |
| "HcsWaitForOperationResult for HcsStartComputeSystem failed (error string: %ls, configuration: %ls)", | ||
| resultDocument.get(), | ||
| Configuration); | ||
| THROW_IF_FAILED_MSG(result, "HcsStartComputeSystem failed (error string: %ls, configuration: %ls)", resultDocument.get(), Configuration); |
There was a problem hiding this comment.
This error message still combines both the Configuration and error string in a single log statement, which can lead to truncation of valuable context (the same issue that was addressed in CreateComputeSystem). Consider applying the same split logging pattern used in CreateComputeSystem to prevent truncation.
| THROW_IF_FAILED_MSG(result, "HcsStartComputeSystem failed (error string: %ls, configuration: %ls)", resultDocument.get(), Configuration); | |
| LOG_IF_FAILED_MSG(result, "HcsStartComputeSystem failed (error string: %ls)", resultDocument.get()); | |
| LOG_IF_FAILED_MSG(result, "HcsStartComputeSystem failed (configuration: %ls)", Configuration); | |
| THROW_IF_FAILED(result); |
* cleanup: minor tweaks to path translation failed messages (#13892) Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com> * Localization change from build: 135812430 (#13905) * Localization change from build: 135812430 * Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * remove unused string --------- Co-authored-by: WSL localization <noreply@microsoft.com> Co-authored-by: Ben Hillis <benhillis@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com> * Resolve issue with config file writing sections outside of their expected header. (#13898) * Resolve issue with config file writing sections outside of their expected header. * add more writewslconfig variations * formatting --------- Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com> * Resolve issue with buttons on notifications not working correctly (#13921) * Resolve issue with buttons on notifications not working correctly * pr feedback --------- Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com> * Fix minor typo in UserConfig.cmake.sample (.exe instead of .dll) (#13926) Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com> * test: extend networking test coverage (#13914) * test: extend coverage of virtioproxy networking mode * test: add dns test variations to all networking classes * remove bridged dns variations * pr feedback --------- Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com> * cleanup: remove duplicate AppId registration for wsldevicehost.dll (#13928) Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com> * Remove the explicit desktop field when creating a Windows process (#13930) * [GH 13837] Remove trailing slash from $XDG_RUNTIME_DIR (#13929) * [GH 13837] Remove trailing slash from $XDG_RUNTIME_DIR * pr feedback --------- Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com> * test: add more path translation variations (#13927) * test: add more path translation variations * Update test/windows/SimpleTests.cpp Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com> * virtiofs: enable additional test cases and skip one racey test (#13933) Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com> * cleanup: add scsi disks during VM creation (#13939) * cleanup: add scsi disks during VM creation * pr feedback --------- Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com> * cleanup: hcs logging improvements (#13942) Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com> * cleanup: switch drvfs.cpp to use common MountUtil helper (#13890) * cleanup: switch drvfs.cpp to use common MountUtil helper * adjust mount.drvfs error logging * adjust mount.drvfs error logging --------- Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com> --------- Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com> Co-authored-by: Blue <OneBlue@users.noreply.github.com> Co-authored-by: WSL localization <noreply@microsoft.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This change improves the logging for the hcs helper functions. Previously due to creation and error strings being rather long, they could be truncated and valuable context could be lost.