[Question] Is it possible to use an ExpressionTemplate using config (appsettings.json)?
See original GitHub issueI’d like to write something like this in my appsettings.json
:
{
"Serilog": {
"Using": [
"Serilog.Expressions"
],
"WriteTo": [
{
"Name": "Console",
"Args": {
"outputTemplate": "[{@t:HH:mm:ss} {@l:u3} ({SourceContext})] {@m} (first item is {Items[0]})\n{@x}"
}
}
]
}
}
Obviously the outputTemplate
doesn’t support expressions. Is there any way to accomplish this? Perhaps this question is better suited to the https://github.com/serilog/serilog-settings-configuration repo.
Issue Analytics
- State:
- Created 3 years ago
- Comments:19 (3 by maintainers)
Top Results From Across the Web
How to use Expression Template with appSettings in Serilog
I've a file sink configured in the appsettings. json of my application. It works perfectly but now I want to add an expression...
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 >Intro to AppSettings in .NET Core - YouTube
In fact, by default, we get five different places to put our settings in each .NET Core application. In this video, we will...
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 >Is there a way to set Serilog formatter variables via appsettings ...
Coding example for the question Is there a way to set Serilog formatter variables via appsettings.json?-.net-core.
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
For anyone else finding this issue, this is actually possible and documented in serilog-settings-configuration, e.g.:
Hi @sanghel-payoff , @rdewaele this is the correct config: