EventLogAppender and log4net
Hey there,
I was looking into configuring Windows event logging for an ASP.NET Core application (running on
I am using DI, so somewhere in my startup code I hook up log4net with
Also tried variants of this (
https://stackoverflow.com/questions/61639853/c-sharp-windows-event-viewer
I looked at the source code here to confirm that:
https://github.com/apache/logging-log4net/blob/master/src/log4net/log4net.csproj#L22C23-L22C44
The project is targeting .NET Framework 4.62 and .NET Standard 2.0. So my takeaway is, that .NET (Core) does not support Windows Event Logs?
I was looking into configuring Windows event logging for an ASP.NET Core application (running on
net8.0) with log4net. In brief, my log4net.config configuration looks something like this:I am using DI, so somewhere in my startup code I hook up log4net with
options.AddLog4Net("log4net.config");. This works fine with everything except the Windows event logger. I registered a new source via PowerShell prior to running the application with:Also tried variants of this (
-LogName Application, etc.) to no avail. An older SO answer suggest that this is not working for .NET applications anymore (so only .NET Framework and .NET Standard compatible versions), see also:https://stackoverflow.com/questions/61639853/c-sharp-windows-event-viewer
I looked at the source code here to confirm that:
https://github.com/apache/logging-log4net/blob/master/src/log4net/log4net.csproj#L22C23-L22C44
The project is targeting .NET Framework 4.62 and .NET Standard 2.0. So my takeaway is, that .NET (Core) does not support Windows Event Logs?
Stack Overflow
I want to log the errors from my C# app in Windows Event Viewer using log4net with the EventLogAppender (the errors must be logged under the Application log)
I have a log4net.config class with this...
I have a log4net.config class with this...
GitHub
Apache Log4net is a versatile, feature-rich, efficient logging API and backend for .NET - apache/logging-log4net
