logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Billy Barnum" <b.bar...@comcast.net>
Subject RE: Inability to use EventLogAppender with ASPNET
Date Tue, 11 Oct 2005 22:20:27 GMT
Try removing your line:

            <logName value="Application"/>

I think what you're doing there is naming a custom EventLog with the same
name as the existing Application log, which in turn requires write access to
the registry. Just remove that line and see what happens.



From: Matthew Brown [mailto:octavius@gmail.com] 
Sent: Monday, October 10, 2005 1:43 PM
To: Log4NET User
Subject: Inability to use EventLogAppender with ASPNET

With log4net internal debugging turned on, an attempt to create an
EventLogAppender for a web application is failing:

[3616] log4net: XmlHierarchyConfigurator: Setting Property [Layout] to
object [log4net.Layout.PatternLayout] 
[3616] log4net: XmlHierarchyConfigurator: Setting Property [LogName] to
String value [Application] 
[3616] log4net:ERROR XmlHierarchyConfigurator: Could not create Appender
[EventLog] of type [log4net.Appender.EventLogAppender]. Reported error
[3616] System.Security.SecurityException: Requested registry access is not
[3616]    at Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean
[3616]    at System.Diagnostics.EventLog.FindSourceRegistration(String
source, String machineName, Boolean readOnly) 
[3616]    at System.Diagnostics.EventLog.SourceExists(String source, String
[3616]    at System.Diagnostics.EventLog.SourceExists(String source) 
[3616]    at log4net.Appender.EventLogAppender.ActivateOptions() 
[3616]    at
nt appenderElement) 
[3616] log4net:ERROR XmlHierarchyConfigurator: Appender named [EventLog] not
[3616] log4net: XmlHierarchyConfigurator: Hierarchy Threshold [] 
[3616] log4net: AppenderSkeleton: Finalizing appender named [EventLog]. 

The FAQ on the log4net site says that the ASPNET account has permission to
write to the event log if created already. Just to be sure, I made sure to
add ASPNET and IUSR_machinename to the Administrators group, but this does
not work either.

Here is my configuration:

<appender name="EventLog" type="log4net.Appender.EventLogAppender" >
            <layout type="log4net.Layout.PatternLayout">
                <conversionPattern value="%date
[%thread][%mdc{AspNetSessionID}] %-5level %logger - %message%newline" />
            <logName value="Application"/>

            <level value="ALL" />
            <appender-ref ref="LogFileAppender" />
            <appender-ref ref="EventLog" />

Sorry if this is a silly newbie question, but I couldn't find much out there
on configuring/using EventLogAppender besides "its tough". Can anyone help?

Matt Brown

View raw message