File tree Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -25,16 +25,34 @@ Log.Logger = new LoggerConfiguration()
25
25
.WriteTo .File (new CompactJsonFormatter (), " ./logs/myapp.json" )
26
26
.CreateLogger ();
27
27
```
28
-
28
+ #### XML ` <appSettings> ` configuration
29
29
To specify the formatter in XML ` <appSettings> ` provide its assembly-qualified type name:
30
30
31
31
``` xml
32
32
<appSettings >
33
- <add key =" serilog:using:File" value =" Serilog.Sinks.RollingFile " />
33
+ <add key =" serilog:using:File" value =" Serilog.Sinks.File " />
34
34
<add key =" serilog:write-to:File.path" value =" ./logs/myapp.json" />
35
35
<add key =" serilog:write-to:File.formatter"
36
36
value =" Serilog.Formatting.Compact.CompactJsonFormatter, Serilog.Formatting.Compact" />
37
37
```
38
+ #### JSON ` appsettings.json ` configuration
39
+ To specify formatter in json ` appsettings.json ` provide its assembly-qualified type name:
40
+
41
+ ``` json
42
+ {
43
+ "Serilog" : {
44
+ "WriteTo" : [
45
+ {
46
+ "Name" : " File" ,
47
+ "Args" : {
48
+ "path" : " ./logs/myapp.json" ,
49
+ "formatter" : " Serilog.Formatting.Compact.CompactJsonFormatter, Serilog.Formatting.Compact"
50
+ }
51
+ }
52
+ ]
53
+ }
54
+ }
55
+ ```
38
56
39
57
### Rendered events
40
58
You can’t perform that action at this time.
0 commit comments