GitHub user alexey-leonovich added a comment to the discussion: Poll: Dropping 
net462 Support in log4net

We are using `EventLogAppender` on Windows in net472 application to log fatal 
errors as an addition to file logging. Logging to the Windows event log can 
also be useful for automated systems that collect and analyze such logs.
Why not to target only `netstandard20` but keep `EventLogAppender` on Windows? 
You are using 
[System.Diagnostics.EventLog](https://www.nuget.org/packages/system.diagnostics.eventlog/)
 nuget under the hood, right? It will throw 
`System.PlatformNotSupportedException: EventLog access is not supported on this 
platform` the you can catch and transform it to warning similar to existing now 
(and harmless):
>  [2026-05-19 14:46:08,911] DEBUG [10] [LogLog:EmitErrorLine] - log4net:ERROR 
> Could not create Appender [EventLogAppender] of type 
> [log4net.Appender.EventLogAppender]. Reported error follows.
> [2026-05-19 14:46:09,052] DEBUG [10] [LogLog:EmitErrorLine] - 
> System.TypeLoadException: Could not load type 
> [log4net.Appender.EventLogAppender]. Tried assembly [log4net, 
> Version=2.0.17.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a] and all 
> loaded assemblies
>    at log4net.Util.SystemInfo.GetTypeFromString(Assembly relativeAssembly, 
> String typeName, Boolean throwOnError, Boolean ignoreCase)
>    at log4net.Util.SystemInfo.GetTypeFromString(String typeName, Boolean 
> throwOnError, Boolean ignoreCase)
>    at 
> log4net.Repository.Hierarchy.XmlHierarchyConfigurator.ParseAppender(XmlElement
>  appenderElement)

GitHub link: 
https://github.com/apache/logging-log4net/discussions/267#discussioncomment-16987402

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to