https://github.com/serilog/serilog-sinks-eventlog
A Serilog sink that writes events to the Windows Event Log
https://github.com/serilog/serilog-sinks-eventlog
Last synced: 3 months ago
JSON representation
A Serilog sink that writes events to the Windows Event Log
- Host: GitHub
- URL: https://github.com/serilog/serilog-sinks-eventlog
- Owner: serilog
- License: apache-2.0
- Created: 2015-02-22T22:49:11.000Z (over 10 years ago)
- Default Branch: dev
- Last Pushed: 2025-01-27T22:52:07.000Z (5 months ago)
- Last Synced: 2025-04-09T16:11:44.857Z (3 months ago)
- Language: C#
- Size: 437 KB
- Stars: 56
- Watchers: 17
- Forks: 31
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES.md
- License: LICENSE
Awesome Lists containing this project
README
# Serilog.Sinks.EventLog
[](https://ci.appveyor.com/project/serilog/serilog-sinks-eventlog/branch/master) [](https://www.nuget.org/packages/Serilog.Sinks.EventLog/)
A Serilog sink that writes events to the Windows Event Log.
> [!IMPORTANT]
> Version 3.0 of this sink changed the default value of `manageEventSource` from `true` to `false`. Applications that run with administrative privileges, and that can therefore create event sources on-the-fly, can opt in by providing `manageEventSource: true` as a configuration option.### Getting started
First, install the package from NuGet:
```
dotnet add package Serilog.Sinks.EventLog
```The sink is configured by calling `WriteTo.EventLog()` on the `LoggerConfiguration`:
```csharp
Log.Logger = new LoggerConfiguration()
.WriteTo.EventLog("Sample App", manageEventSource: true)
.CreateLogger();Log.Information("Hello, Windows Event Log!");
Log.CloseAndFlush();
```Events will appear under the Application log with the specified source name:
