Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid compressed file #5

Open
szakmaster opened this issue Apr 12, 2023 · 1 comment
Open

Invalid compressed file #5

szakmaster opened this issue Apr 12, 2023 · 1 comment

Comments

@szakmaster
Copy link

We already use the log file generation with Serilog.Sinks.File in our .NET 6 project and want to add the compressed log file output to a separate folder archiving the logs. However, the created compressed files are corrupted, they are invalid.

Serilog is configured via appconfig.json:

"Serilog": {
"Using": [ "SeriLog.Sinks.Console", "Serilog.Sinks.File", "Serilog.Sinks.Async" ],
"MinimumLevel": {
"Default": "Information",
"Override": {
"Microsoft": "Warning",
"System": "Warning"
}
},
"WriteTo": [
{
"Name": "Console"
},
{
"Name": "File",
"Args": {
"path": "Logs/log.gz",
"rollingInterval": "Day",
"formatter": "Serilog.Formatting.Json.JsonFormatter, Serilog",
"hooks": "Serilog.Sinks.File.GZip.GZipHooks, Serilog.Sinks.File.GZip"
}
},
{
"Name": "File",
"Args": {
"path": "Logs/log.log",
"rollingInterval": "Day",
"formatter": "Serilog.Formatting.Json.JsonFormatter, Serilog"
}
}
],
"Enrich": [ "FromLogContext", "WithMachineName", "WithThreadId" ],
"Properties": {
"Application": "MyApplication"
}
}
Log_error1
Log_error2

@cocowalla
Copy link
Owner

Hmm, is the app being properly shutdown, with a call to Serilog.Flush() before termination?

My guess here is that the ZIP write stream is being terminated while it's still being written to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants