Fix misplaced quote in the tool-failure log line#821
Merged
Conversation
LogFailedResult passed the error summary as a {Detail} string that already
included the " : " separator. The app's {Message} output template quotes
string values, so the separator was pulled inside the quotes and rendered
as "ExitCode: 0" : ...", with the quote landing right after the exit code.
Log the summary as its own {Error} value with the " : " separator in the
template, so only the error text is quoted: ExitCode: 0 : "...". The exit
code can be 0 on a failure because ffmpeg can exit 0 yet report a fatal
error on stderr (FfMpegTool treats non-zero exit or any stderr as failure).
Add tests that render through the {Message} template to verify the quote
placement.
There was a problem hiding this comment.
Pull request overview
This PR fixes the formatting of tool-failure log lines by separating the error summary into its own structured log value, preventing the " : " separator from being pulled inside Serilog’s string quoting when rendered via the {Message} output template.
Changes:
- Update
MediaTool.LogFailedResult(BufferedCommandResult)to log failures with/without an error summary using distinct templates. - Add an xUnit test (
ToolFailureLogFormatTests) that renders via{Message}and asserts the exit code is not followed by a stray quote and that only the error text is quoted.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| PlexCleaner/MediaTool.cs | Adjusts failure logging templates to keep the " : " separator outside Serilog-quoted string values. |
| PlexCleanerTests/ToolFailureLogFormatTests.cs | Adds regression tests validating the exact rendered {Message} formatting for tool-failure lines. |
This was referenced Jul 10, 2026
ptr727
added a commit
that referenced
this pull request
Jul 11, 2026
Replace the assembly-wide xunit.runner.json parallelizeTestCollections:false (added in #821, which slowed the whole suite) with a 'Sequential' collection using DisableParallelization, applied only to the two tests that swap the global Serilog Log.Logger. The rest of the suite parallelizes again.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A tool-failure line rendered with a stray quote right after the exit code:
MediaTool.LogFailedResult(BufferedCommandResult)passed the error summary as a{Detail}string that already contained the" : "separator. The app's output templates use{Message}(not:lj) so Serilog quotes string values — which pulled the separator inside the quotes, so the opening quote landed right afterExitCode: 0.ExitCode: 0on a failure is expected, not a bug:FfMpegTooltreats a non-zero exit or any stderr text as a failure (FfMpegTool.cs:161-165), because ffmpeg can exit 0 yet report a fatal error (here, a non-monotonic dts muxer error) on stderr.Fix
Log the summary as its own
{Error}value with the" : "separator in the template, so only the error text is quoted:Tests
Added
ToolFailureLogFormatTeststhat render through the same{Message}template the sinks use and assert the exit code is clean and only the error text is quoted (theNotContain("ExitCode: 0\"")assertion guards the regression). Full suite: 193 pass, formatters/linters clean.