I have a problem with log4net permission from ASP.Net 4.0 web application to write to the application event log when the user is not a member of the administrator group in Windows 2008 R2 and IIS 7. We use NT authentication and impersonation. As soon as I assign the user group admin, it works fine. I tried with many permission settings, such as providing Authenticated Users full Eventlog permissions in the registry, etc., and none of them work. If someone can help, it will be great.
When I had a similar logging problem in eventlog from a .net 1.1 application on a Windows 2003 server, I wrote to CustomSD as shown below and it worked
http://mossipqueen.wordpress.com/2008/08/04/cannot-open-log-for-source-you-may-not-have-write-access/
The error I am getting is given below from the log4net internal log.
log4net:ERROR [EventLogAppender] Unable to write to event log [Application] using source [*******]
System.InvalidOperationException: Cannot open log for source '*******'. You may not have write access. ---> System.ComponentModel.Win32Exception: Access is denied
--- End of inner exception stack trace ---
at System.Diagnostics.EventLogInternal.OpenForWrite(String currentMachineName)
at System.Diagnostics.EventLogInternal.InternalWriteEvent(UInt32 eventID, UInt16 category, EventLogEntryType type, String[] strings, Byte[] rawData, String currentMachineName)
at System.Diagnostics.EventLogInternal.WriteEntry(String message, EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData)
at System.Diagnostics.EventLog.WriteEntry(String source, String message, EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData)
at log4net.Appender.EventLogAppender.Append(LoggingEvent loggingEvent)
source
share