Support ILoggingFailureListener#342
Conversation
…chnically a breaking change
| SelfLog.WriteLine("Log event {0} was lost since it was not possible to open the file or create a new one.", logEvent.RenderMessage()); | ||
| } | ||
| */ | ||
| failed = _currentFile == null; |
There was a problem hiding this comment.
I will have a look beginning next week, thanks 🎉
There was a problem hiding this comment.
@nblumhardt There is sadly no artifact to use on AppVeyor as the build "failed successfully" ;)
https://ci.appveyor.com/project/serilog/serilog-sinks-file/builds/51655364
I will create a local build for testing for now, but you might want to fix the CI pipeline if you intend to use Actions + AppVeyor in parallel. If you are dropping AppVeyor with this PR as-well, I would add
There was a problem hiding this comment.
Did some testing and seems to work as expected. Thanks!
Could you still have a hotfix-release for #337 before having this major release? Our company policy requires some effort on switching major version, so for getting the bug fixed first on our current version would help me a lot!
| $branch = @{ $true = $env:CI_TARGET_BRANCH; $false = $(git symbolic-ref --short -q HEAD) }[$NULL -ne $env:CI_TARGET_BRANCH]; | ||
| $revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:CI_BUILD_NUMBER, 10); $false = "local" }[$NULL -ne $env:CI_BUILD_NUMBER]; | ||
| $suffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)) -replace '([^a-zA-Z0-9\-]*)', '')-$revision"}[$branch -eq "main" -and $revision -ne "local"] | ||
| $commitHash = $(git rev-parse --short HEAD) | ||
| $buildSuffix = @{ $true = "$($suffix)-$($commitHash)"; $false = "$($branch)-$($commitHash)" }[$suffix -ne ""] |
There was a problem hiding this comment.
NIT: Only a suggestion to comply better with SemVer 2.0.0
https://learn.microsoft.com/en-us/nuget/concepts/package-versioning?tabs=semver20sort#pre-release-versions suggests to use the version in the format 7.0.0-selflog-on.1+04ac85d instead of 7.0.0-selflog-on-00001-04ac85d. Doing this will also allow you to just use $suffix instead of differentiating with $buildSuffix since the nuget package (and any relevant other part) will drop the metadata part as documented by https://learn.microsoft.com/en-us/nuget/concepts/package-versioning?tabs=semver20sort#normalized-version-numbers
Using the . instead of - before the CI number also signifies it's a numeric and should be sorted as such. NuGet/VisualStudio/... is aware of that, which makes it nicer than padding it to 5 digits. This is widely supported since VS 2017.
| $branch = @{ $true = $env:CI_TARGET_BRANCH; $false = $(git symbolic-ref --short -q HEAD) }[$NULL -ne $env:CI_TARGET_BRANCH]; | |
| $revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:CI_BUILD_NUMBER, 10); $false = "local" }[$NULL -ne $env:CI_BUILD_NUMBER]; | |
| $suffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)) -replace '([^a-zA-Z0-9\-]*)', '')-$revision"}[$branch -eq "main" -and $revision -ne "local"] | |
| $commitHash = $(git rev-parse --short HEAD) | |
| $buildSuffix = @{ $true = "$($suffix)-$($commitHash)"; $false = "$($branch)-$($commitHash)" }[$suffix -ne ""] | |
| $branch = @{ $true = $env:CI_TARGET_BRANCH; $false = $(git symbolic-ref --short -q HEAD) }[$NULL -ne $env:CI_TARGET_BRANCH]; | |
| $revision = @{ $true = "{0}" -f [convert]::ToInt32("0" + $env:CI_BUILD_NUMBER, 10); $false = "local" }[$NULL -ne $env:CI_BUILD_NUMBER]; | |
| $suffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)) -replace '([^a-zA-Z0-9\-]*)', '').$revision"}[$branch -eq "main" -and $revision -ne "local"] | |
| $buildSuffix = @{ $true = "$($suffix)"; $false = "$($branch)" }[$suffix -ne ""] |
There was a problem hiding this comment.
Personally I would use 7.0.0-ci.1+04ac85d-selflog-on-open-failure, but tried to keep the suggestion closer to what you do right now.
There was a problem hiding this comment.
Additionally, there seems to be something in place that adds the full revision anyway:
The result locally was: 7.0.0-selflog-on.1+04ac85d60ddb0e109312ca820a113b599d286dc9 with my change and 7.0.0-selflog-on-00001-04ac85d+04ac85d60ddb0e109312ca820a113b599d286dc9 with your current code.
I did check if this was local-only or also from the official packages, and the latest version on NuGet is 6.0.0+c7b9bc3d87f9bb98572a52286135efda1e608ad6.
There was a problem hiding this comment.
Thanks for digging into this! These scripts are from the upstream serilog/serilog and we're trying to avoid configuration drift by making any changes up there. I agree this could be better 👍 - I'll leave this as-is here but take a look in the next round of maintenance on the Serilog package.
| catch (AbandonedMutexException) | ||
| { | ||
| SelfLog.WriteLine("Inherited shared file mutex after abandonment by another process"); | ||
| SelfLog.WriteLine("inherited the shared file mutex after abandonment by another process"); |
There was a problem hiding this comment.
Is this intentionally sticking with SelfLog directly? Just asking as it's the only call to SelfLog.WriteLine that remained.
There was a problem hiding this comment.
Thanks for taking a look. Yes, this one doesn't go through the failure listener because it's not a failure. In this situation, another process failed, but we've picked up the mutex and we're carrying on.
There was a problem hiding this comment.
I do like the concept of having every log still appearing somewhere if everything went wrong. Thanks!
|
@Falco20019 thanks for taking a look a this. I am not sure about the timeline for releasing a patch, it's not hugely likely we'd push a point release out, as some additional work would be needed to get the original AppVeyor build through, and each new version causes some additional effort for downstream consumers. Since |
|
It's fine, I just asked in case you are fine with it. As we are using an internal NuGet Repository, I will just publish a hotfix version there to be used and switch back to official releases in November. Not the first time we have to do it and surely not the last. |
Updated [Serilog.AspNetCore](https://github.com/serilog/serilog-aspnetcore) from 9.0.0 to 10.0.0. <details> <summary>Release notes</summary> _Sourced from [Serilog.AspNetCore's releases](https://github.com/serilog/serilog-aspnetcore/releases)._ ## 10.0.0 ## What's Changed * Update deprecated NuGet packages Microsoft.AspNetCore.* by @adamashton in serilog/serilog-aspnetcore#399 * Update to .NET 10 SDK and dependencies by @nblumhardt in serilog/serilog-aspnetcore#401 ## New Contributors * @adamashton made their first contribution in serilog/serilog-aspnetcore#399 **Full Changelog**: serilog/serilog-aspnetcore@v9.0.0...v10.0.0 Commits viewable in [compare view](serilog/serilog-aspnetcore@v9.0.0...v10.0.0). </details> Updated [Serilog.Settings.Configuration](https://github.com/serilog/serilog-settings-configuration) from 9.0.0 to 10.0.0. <details> <summary>Release notes</summary> _Sourced from [Serilog.Settings.Configuration's releases](https://github.com/serilog/serilog-settings-configuration/releases)._ ## 10.0.0 ## What's Changed * Cleanup the TestApp files by @0xced in serilog/serilog-settings-configuration#449 * Fix typo in destructuring policy description by @grinn in serilog/serilog-settings-configuration#460 * Update to `net10.0` SDK and dependencies by @nblumhardt in serilog/serilog-settings-configuration#462 * Remove `FluentAssertions` by @nblumhardt in serilog/serilog-settings-configuration#464 ## New Contributors * @grinn made their first contribution in serilog/serilog-settings-configuration#460 **Full Changelog**: serilog/serilog-settings-configuration@v9.0.0...v10.0.0 Commits viewable in [compare view](serilog/serilog-settings-configuration@v9.0.0...v10.0.0). </details> Updated [Serilog.Sinks.Console](https://github.com/serilog/serilog-sinks-console) from 6.0.0 to 6.1.1. <details> <summary>Release notes</summary> _Sourced from [Serilog.Sinks.Console's releases](https://github.com/serilog/serilog-sinks-console/releases)._ ## 6.1.1 ## What's Changed * Report the number of escape characters formatted into themed sequence rendering by @nblumhardt in serilog/serilog-sinks-console#136 **Full Changelog**: serilog/serilog-sinks-console@v6.1.0...v6.1.1 ## 6.1.0 * #165 - support for `{UtcTimestamp}` in output templates (@ManuelRin) * #172, #173 - switch build to Serilog org standard (@nblumhardt) Commits viewable in [compare view](serilog/serilog-sinks-console@v6.0.0...v6.1.1). </details> Updated [Serilog.Sinks.File](https://github.com/serilog/serilog-sinks-file) from 6.0.0 to 7.0.0. <details> <summary>Release notes</summary> _Sourced from [Serilog.Sinks.File's releases](https://github.com/serilog/serilog-sinks-file/releases)._ ## 7.0.0 ## What's Changed * Fix issue with force-reopen after 30 minutes by @Falco20019 in serilog/serilog-sinks-file#337 * Support `ILoggingFailureListener` by @nblumhardt in serilog/serilog-sinks-file#342 ## New Contributors * @Falco20019 made their first contribution in serilog/serilog-sinks-file#337 **Full Changelog**: serilog/serilog-sinks-file@v4.1.0...v7.0.0 Commits viewable in [compare view](serilog/serilog-sinks-file@v6.0.0...v7.0.0). </details> Updated [Swashbuckle.AspNetCore](https://github.com/domaindrivendev/Swashbuckle.AspNetCore) from 10.1.4 to 10.1.5. <details> <summary>Release notes</summary> _Sourced from [Swashbuckle.AspNetCore's releases](https://github.com/domaindrivendev/Swashbuckle.AspNetCore/releases)._ ## 10.1.5 ## What's Changed * Bump swagger-ui-dist from 5.31.1 to 5.32.0 in /src/Swashbuckle.AspNetCore.SwaggerUI by @dependabot in domaindrivendev/Swashbuckle.AspNetCore#3814 * Migrate to actions/attest by @martincostello in domaindrivendev/Swashbuckle.AspNetCore#3815 * Disable secrets-outside-env audit by @martincostello in domaindrivendev/Swashbuckle.AspNetCore#3823 * Update zizmor to 1.23.1 by @martincostello in domaindrivendev/Swashbuckle.AspNetCore#3825 * Fix null examples by @jgarciadelanoceda in domaindrivendev/Swashbuckle.AspNetCore#3803 * Bump dependencies by @martincostello in domaindrivendev/Swashbuckle.AspNetCore#3835 **Full Changelog**: domaindrivendev/Swashbuckle.AspNetCore@v10.1.4...v10.1.5 Commits viewable in [compare view](domaindrivendev/Swashbuckle.AspNetCore@v10.1.4...v10.1.5). </details> Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore <dependency name> major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself) - `@dependabot ignore <dependency name> minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself) - `@dependabot ignore <dependency name>` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself) - `@dependabot unignore <dependency name>` will remove all of the ignore conditions of the specified dependency - `@dependabot unignore <dependency name> <ignore condition>` will remove the ignore condition of the specified dependency and ignore conditions </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Seals
PeriodicFlushToDiskSink, so technically a breaking change.Includes a switch to Actions for CI.