Sitecore CMS uses the log4net library to output log statements to Sitecore log files in the “\Data\logs” folder according to the Sitecore “LogFolder” setting from the web.config file.
By default, log4net is configured to use the “SitecoreLogFileAppender” appender. However, the log4net library includes other build-in appenders, such as the “EventLogAppender” appender.
The “EventLogAppender” appender is designed to log to the Windows Application Event Log on a workstation where Sitecore instance is deployed.
The recommended approach to configure Sitecore CMS to use the “EventLogAppender” appender would be the following:
<appender name="EventLogAppender" type="log4net.Appender.EventLogAppender, Sitecore.Logging" >Note: in the “ApplicationName” parameter you can specify the application name, which will be shown in the “Source” field of Windows Event Log.
<param name="ApplicationName" value="Sitecore CMS" />
<param name="Threshold" value="ERROR" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%4t %d{ABSOLUTE} %-5p %m%n" />
</layout>
</appender>
<appender-ref ref="EventLogAppender" />
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\eventlog\Application\Sitecore CMSNote: the registry key value must be the same as specified in the “ApplicationName” parameter for the “EventLogAppender” appender.