Is there a way to pass json formatter using appsettings.json?
See original GitHub issueSomehow like this
"Serilog": {
"MinimumLevel": {
"Default": "Debug",
"Override": {
"Microsoft": "Fatal",
"System": "Fatal",
}
},
"Using": [
"Serilog.Sinks.File",
],
"WriteTo": [
{
"Name": "File",
"Args": {
"pathFormat": "logs/log.log",
"formatter": "Serilog.Formatting.Json.JsonFormatter, Serilog"
}
}
]
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Is there a way to set Serilog formatter variables via ...
json file would be represented in C# as something like this: Log.Logger = new LoggerConfiguration() .ReadFrom.Configuration(configuration) .
Read more >Customized JSON formatting with Serilog
This post collects all kinds of JSON formatting examples using ExpressionTemplate , and I'll add to them as new questions come my way...
Read more >How to get json values and pass it in same appsetting ...
To get the json values from the appsetting.json file, you could use the Configuration. For example: Consider the following appsettings.json file ...
Read more >How to Read AppSettings Values From a JSON File in . ...
Explains how to read AppSettings values from a JSON file in ASP.NET Core including rich examples and code samples.
Read more >Appsettings.json in .NET: How to read and get a value
The appsettings. json is used in .NET and .NET Core applications to read and get a value from the configuration file using the...
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,
yes this should work, and I believe you should be able to omit the
, Serilog
at the end of"Serilog.Formatting.Json.JsonFormatter, Serilog"
You can find more configuration examples in https://github.com/tsimbalar/serilog-settings-comparison/blob/master/docs/README.md
@mincasoft the
WriteTo.File()
method takes anEncoding
item as a parameter (you can see it in the comment above). If this isn’t what you’re looking for, would appreciate if you could open a new issue 🙏