An event sink for Serilog that writes to the Seq event server. Distributed via NuGet.
From the NuGet Package Manager Console:
PM> Install-Package Seq.Client.Serilog
The package uses the Seq
namespace:
using Seq;
Configure Serilog using the WriteTo.Seq()
extension method on LoggerConfiguration
:
Log.Logger = new LoggerConfiguration()
.WriteTo.Seq("http://my-seq-server")
.CreateLogger();
In Serilog's defaut configuration, events with Information
level and above will be recorded. If
you choose to increase the base logging level, e.g. to Debug
, you can set the Seq sink to
Information
-level to prevent large volumes of network traffic:
.WriteTo.Seq("http://my-seq-server", restrictedToMinimumLevel: LogEventLevel.Information)
The sink transmits log events to the server asynchronously to avoid heavy performance penalties. Buffered events will be flushed and any outstanding network requests will be completed when the hosting application terminates normally. If the application is terminated via an attached debugger, the task manager or as a result of hard termination such as stack overflow, events in transit may be lost.
To address this, and to prevent lost events when network or server issues prevent delivery, a buffer file set may be specified:
.WriteTo.Seq("http://my-seq-server", bufferBaseFilename: @"C:\Logs\my-app")
This will create files of the format my-app-{Date}.jsnl
, where events will be written until they can
be reliably shipped to the server.
The client software included in this repository is provided under the terms of the Apache 2.0 license.
This does not extend to any third-party packages, Serilog or the Seq server, which are distributed by their respective owners under their own licenses.