An Apache log4net appender that writes events to Seq.
The Seq appender for log4net supports both .NET Framework 4.0+, and .NET Core via .NET Standard 2.0.
To install Seq.Client.Log4Net from NuGet, at the Visual Studio Package Manager console, type:
Install-Package Seq.Client.Log4Net
Then, add the appender to your log4net configuration:
<appender name="SeqAppender" type="Seq.Client.Log4Net.SeqAppender, Seq.Client.Log4Net" >
<bufferSize value="1" />
<serverUrl value="http://my-seq" />
<apiKey value="" />
</appender>
Set the serverUrl
value to the address of your Seq server. Set the apiKey
value to your Seq API key, if required.
Finally, add a reference to the appender in the appropriate configuration section:
<root>
<level value="INFO" />
<appender-ref ref="SeqAppender" />
</root>
That's it! When you write log events to your log4net ILogger
:
log.InfoFormat("Hello, {0}, from log4net!", Environment.UserName);
They'll appear beautifully in Seq.
By default, the appender is synchronous. This can lead to application slowdowns.
For acceptable production performance, we recommend the use of Log4Net.Async and a buffer size of 100 or greater. See this log4net configuration for full configuation sample.
Note regarding NLog 4.0 and SLAB clients:
This repository originally included Seq.Client.NLog, targeting NLog 4.0, and Seq.Client.Slab, targeting Microsoft SLAB. The NLog client has been replaced with the much-improved NLog.Targets.Seq, while the SLAB client is now deprecated with no replacement currently planned. Both of these projects can be viewed in the
deprecated-nlog-slab
branch.