%AppData% folder not correctly replaced in appsettings.json
See original GitHub issueI have the following appsettings.json
:
"Serilog": {
"Using": [ "Serilog.Sinks.File" ],
"MinimumLevel": "Debug",
"WriteTo": [
{ "Name": "File", "Args": { "path": "%APPDATA%\\CompanyName\\ApplicationName.txt", "rollingInterval": "Day", "fileSizeLimitBytes": 26214400, "rollOnFileSizeLimit": true } }
],
"Enrich": [ "FromLogContext", "WithMachineName", "WithThreadId" ],
"Destructure": [
{ "Name": "ToMaximumDepth", "Args": { "maximumDestructuringDepth": 4 } },
{ "Name": "ToMaximumStringLength", "Args": { "maximumStringLength": 100 } },
{ "Name": "ToMaximumCollectionCount", "Args": { "maximumCollectionCount": 10 } }
],
"Properties": {
"Application": "Name"
}
},
and I initialize Serilog reading the resulting configuration.
Anyway, the result is not exactly what I would expect (using the AppData
system folder). I get instead an %AppData%
folder created and containing the logs:
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
cannot find real location of %APPDATA%\Code\User\ ...
Settings file locations. Depending on your platform, the user settings file is located here: Windows %APPDATA%\Code\User\settings.json.
Read more >Adding AppSettings.json Configuration to a .NET Core ...
This post will walk you through the steps necessary to add a strongly typed appsettings.json configuration file to your console application.
Read more >Configure ASP.NET Core Data Protection
Learn how to configure Data Protection in ASP.NET Core.
Read more >Configuration builders for ASP.NET
Learn how to get configuration data from sources other than web.config values from external sources.
Read more >Secrets Management in .NET Applications
In this article, you have learned that using the default appsettings.json configuration file to store your .NET application's secrets is not a good...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi, @fleed , @mishrapw , @nblumhardt . Actually, it should work (just tested), see https://github.com/serilog/serilog-settings-configuration/blob/dev/src/Serilog.Settings.Configuration/Settings/Configuration/StringArgumentValue.cs#L31
what version of the package do you use?
Aha! I’d forgotten about the progress on this, sorry 😃