logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ron Grabowski <rongrabow...@yahoo.com>
Subject Re: EventLogAppender
Date Wed, 17 Aug 2005 15:23:12 GMT
I've never used the EventLogAppender before so this is a learning
experience for me too. 

When I copied your code into my log4net.config file for a ASP.Net
project I'm working on under Windows XP Pro I saw the following error
in my log4net log:

log4net:ERROR XmlHierarchyConfigurator: Could not create Appender
[EventLogAppender] of type [log4net.Appender.EventLogAppender].
Reported error follows.
System.Security.SecurityException: Requested registry access is not
   at Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean
   at System.Diagnostics.EventLog.FindSourceRegistration(String source,
String machineName, Boolean readOnly)
   at System.Diagnostics.EventLog.SourceExists(String source, String
   at System.Diagnostics.EventLog.SourceExists(String source)
   at log4net.Appender.EventLogAppender.ActivateOptions()

That error led me to this article:


I copied the C# class into a new project and ran the code as described.
A InstallUtil.InstallLog file was created. It ended with the following

The Commit phase completed successfully.

The transacted install has completed.

Does anyone know if its possible to uninstall the thing I just

I re-built my ASP.Net solution and saw the same message in my log4net
log file.

I found this log4net FAQ entry:


I'm not an EventLog guru so I'm curious why its not working as well. In
the KB article, they created a source called TEST. Is there a way to
set the source via the EventLogAppender? Do I need to set that? Is that
what the ApplicationName property on the EventLogAppender is for?


--- Paul Cowan <Paul.Cowan@jkd.co.uk> wrote:

> I have the following appender
>             <appender name="EventLogAppender"
> type="log4net.Appender.EventLogAppender" >
>                   <layout type="log4net.Layout.PatternLayout">
>                         <param name="ConversionPattern" value="%d
> [%t]
> %-5p %c [%x] - %m%n" />
>                   </layout>
>             </appender>
> I simply cannot get any entries into the event log.  Has anyone any
> idea
> why??
> _____________________________________________________________________
> VirusChecked for Huntsworth plc
> _____________________________________________________________________

View raw message