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.

-BillyB



WILLIAM BARNUM
b.barnum@comcast.net

________________________________________
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
follows. 
[3616] System.Security.SecurityException: Requested registry access is not
allowed. 
[3616]    at Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean
writable) 
[3616]    at System.Diagnostics.EventLog.FindSourceRegistration(String
source, String machineName, Boolean readOnly) 
[3616]    at System.Diagnostics.EventLog.SourceExists(String source, String
machineName) 
[3616]    at System.Diagnostics.EventLog.SourceExists(String source) 
[3616]    at log4net.Appender.EventLogAppender.ActivateOptions() 
[3616]    at
log4net.Repository.Hierarchy.XmlHierarchyConfigurator.ParseAppender(XmlEleme
nt appenderElement) 
[3616] log4net:ERROR XmlHierarchyConfigurator: Appender named [EventLog] not
found. 
[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" />
            </layout>
            <logName value="Application"/>
        </appender>

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

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?

Thanks,
Matt Brown


Mime
View raw message