Skip to content

Commit 7893956

Browse files
authored
Added notes on sharing [Skip CI]
1 parent f51fbc1 commit 7893956

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

README.md

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

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.
17+
> **Important:** By default only one process may use a log file at a given time. See _Shared log files_ below if multi-process logging is required.
1818
1919
### `<appSettings>` configuration
2020

@@ -36,6 +36,14 @@ To emit JSON, rather than plain text, a formatter can be specified:
3636

3737
To configure an alternative formatter in XML `<appSettings>`, specify the formatter's assembly-qualified type name as the setting `value`.
3838

39+
### Shared log files
40+
41+
Multiple processes can concurrently write to the same log file if the `shared` parameter is set to `true`:
42+
43+
```csharp
44+
.WriteTo.File("log.txt", shared: true)
45+
```
46+
3947
### Performance
4048

4149
By default, the file sink will flush each event written through it to disk. To improve write performance, specifying `buffered: true` will permit the underlying stream to buffer writes.

0 commit comments

Comments
 (0)