Documentation
DocumentationDiscussions
Documentation
These docs are for v5.1. Click to read the latest docs for v2024.3.

Using log4net

Seq works best with richly-structured event data like that produced by Serilog, ASP.NET Core and NLog 4.5+.

If you currently use log4net however, you're not left out; we provide a log4net appender that writes events to Seq via HTTP.

Installing the Appender

At the time of writing, the Seq appender for log4net supports .NET 4+.

At the Visual Studio Package Manager console, type:

PM> Install-Package Seq.Client.Log4Net

This will add the required assemblies to the project.

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" />
</appender>

Set the serverUrl value to the address of your Seq server.

🚧

Note the buffer size of 1; the appender supports buffering for better performance if required.

Finally, add a reference to the appender in the appropriate configuration section:

<root>
  <level value="INFO" />
  <appender-ref ref="SeqAppender" />
</root>

Writing events

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.