Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 1 day 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 9 years ago)
- Default Branch: dev
- Last Pushed: 2024-06-23T22:43:40.000Z (5 months ago)
- Last Synced: 2024-11-07T17:42:39.477Z (8 days ago)
- Language: C#
- Size: 427 KB
- Stars: 50
- Watchers: 18
- Forks: 29
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES.md
- License: LICENSE
Awesome Lists containing this project
README
# Serilog.Sinks.EventLog
[![Build status](https://ci.appveyor.com/api/projects/status/j1iodeatf9ykrluf/branch/master?svg=true)](https://ci.appveyor.com/project/serilog/serilog-sinks-eventlog/branch/master) [![NuGet Version](http://img.shields.io/nuget/v/Serilog.Sinks.EventLog.svg?style=flat)](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:
![Screenshot](https://raw.githubusercontent.com/serilog/serilog-sinks-eventlog/dev/assets/Screenshot.png)