|
1 | | -# Seq.Extensions.Logging [](https://ci.appveyor.com/project/datalust/seq-extensions-logging) [](https://nuget.org/packages/Seq.Extensions.Logging) [](https://gitter.im/datalust/seq) |
| 1 | +# Seq.Extensions.Logging [](https://ci.appveyor.com/project/datalust/seq-extensions-logging) [](https://nuget.org/packages/Seq.Extensions.Logging) |
2 | 2 |
|
3 | 3 | [Seq](https://datalust.co/seq) is a flexible self-hosted back-end for the ASP.NET Core logging subsystem (_Microsoft.Extensions.Logging_). Log events generated by the framework and application code are sent over HTTP to a Seq server, where the structured data associated with each event is used for powerful filtering, correlation, and analysis. |
4 | 4 |
|
@@ -47,7 +47,7 @@ class HomeController : Controller |
47 | 47 |
|
48 | 48 | Log messages will be sent to Seq in batches and be visible in the Seq user interface. Observe that correlation identifiers added by the framework, like `RequestId`, are all exposed and fully-searchable in Seq. |
49 | 49 |
|
50 | | -### Logging with message templates~~~~ |
| 50 | +### Logging with message templates |
51 | 51 |
|
52 | 52 | Seq supports the templated log messages used by _Microsoft.Extensions.Logging_. By writing events with _named format placeholders_, the data attached to the event preserves the individual property values. |
53 | 53 |
|
@@ -114,6 +114,18 @@ var json = "{\"A\": 42}"; |
114 | 114 | _logger.LogInformation("The answer is {Answer}", new JsonSafeString(json)); |
115 | 115 | ``` |
116 | 116 |
|
| 117 | +### Trace and span correlation |
| 118 | + |
| 119 | +The Seq logger provider automatically adds trace and span ids to events when present, enabling the _Trace_ drop-down menu in Seq's expanded event view. |
| 120 | + |
| 121 | +ASP.NET Core may add additional top-level `TraceId`, `SpanId`, and `ParentId` properties in its default configuration. You can remove these if you wish, using `ILoggingBuilder.Configure()`: |
| 122 | + |
| 123 | +```csharp |
| 124 | +builder.Logging.Configure(opts => { |
| 125 | + opts.ActivityTrackingOptions = ActivityTrackingOptions.None; |
| 126 | +}); |
| 127 | +``` |
| 128 | + |
117 | 129 | ### Troubleshooting |
118 | 130 |
|
119 | 131 | > Nothing showed up, what can I do? |
@@ -150,11 +162,13 @@ Seq.Extensions.Logging.SelfLog.Enable(message => { |
150 | 162 | * Turn on the `SelfLog` as described above to check for connectivity problems and other issues on the client side. |
151 | 163 | * [Raise an issue ](https://github.com/datalust/seq-extensions-logging/issues), ask for help on the [Seq support forum ](http://docs.datalust.co/discuss) or email **[email protected]**. |
152 | 164 |
|
153 | | -### Migrating to Serilog |
| 165 | +### Versioning policy |
154 | 166 |
|
155 | | -This package is based on a subset of the powerful [Serilog](https://serilog.net) library. Not all of the options supported by the Serilog and Seq client libraries are present in |
156 | | -the _Seq.Extensions.Logging_ package. Migrating to the full Serilog API however is very easy: |
| 167 | +The major version of this package tracks the major version of its _Microsoft.Extensions.Logging_ dependency. So, if your |
| 168 | +application (on any target runtime) is targeting `net6.0`, use the latest 6.* version of this package. Likewise, if |
| 169 | +you're targeting `net8.0`, target a 8.* version of _Seq.Extensions.Logging_ for the best experience. |
157 | 170 |
|
158 | | - 1. Install packages _Serilog_, _Serilog.Extensions.Logging_ and _Serilog.Sinks.Seq_. |
159 | | - 2. Follow the instructions [here](https://github.com/serilog/serilog-extensions-logging) to change `AddSeq()` into `AddSerilog()` with a `LoggerConfiguration` object passed in |
160 | | - 3. Add `WriteTo.Seq()` to the Serilog configuration as per [the example](https://github.com/serilog/serilog-sinks-seq) given for the Seq sink for Serilog |
| 171 | +### Credits |
| 172 | + |
| 173 | +This package is based on a subset of the powerful [Serilog](https://serilog.net) library. Not all of the options supported by the Serilog and Seq client libraries are present in |
| 174 | +the _Seq.Extensions.Logging_ package. |
0 commit comments