Skip to content

Commit fae9a0e

Browse files
authored
More README examples [Skip CI]
1 parent b0090e4 commit fae9a0e

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

README.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,25 @@ To avoid bringing down apps with runaway disk usage the file sink **limits file
1414
.WriteTo.File("log.txt", fileSizeLimitBytes: null)
1515
```
1616

17-
Or in XML [app-settings format](https://github.com/serilog/serilog/wiki/AppSettings):
17+
> **Important:** Only one process may write to a log file at a given time. For multi-process scenarios, either use separate files or one of the non-file-based sinks.
18+
19+
### `<appSettings>` configuration
20+
21+
The sink can be configured in XML [app-settings format](https://github.com/serilog/serilog/wiki/AppSettings) if the _Serilog.Settings.AppSettings_ package is in use:
1822

1923
```xml
2024
<add key="serilog:write-to:File.path" value="log.txt" />
25+
<add key="serilog:write-to:File.fileSizeLimitBytes" value="" />
2126
```
2227

23-
> **Important:** Only one process may write to a log file at a given time. For multi-process scenarios, either use separate files or one of the non-file-based sinks.
28+
### JSON formatting
29+
30+
To emit JSON, rather than plain text, a formatter can be specified:
31+
32+
```csharp
33+
.WriteTo.File(new JsonFormatter(), "log.txt")
34+
```
35+
36+
To configure an alternative formatter in XML `<appSettings>`, specify the formatter's assembly-qualified type name as the setting `value`.
2437

25-
Copyright &copy; 2016 Serilog Contributors - Provided under the [Apache License, Version 2.0](http://apache.org/licenses/LICENSE-2.0.html).
38+
_Copyright &copy; 2016 Serilog Contributors - Provided under the [Apache License, Version 2.0](http://apache.org/licenses/LICENSE-2.0.html)._

0 commit comments

Comments
 (0)