Issuing log4Net event log permissions using an account without administrator

This is probably not a problem with SiteCore as such, but I have included it for completeness. I have sitecore 6.3 running under IIS7 using a user id for the application pool. I cannot get Sitecore to write log information (using the default log4net settings) to the event log. I went for advice here: http://logging.apache.org/log4net/release/faq.html#Why%20doesn%27t%20the%20EventLogAppender%20work? , and although it works great when I make an individual identifier a member of the admin group, I need to find a way to make it work in production without such a security hack.

It is strange that I have an MSI that installs it (runs under an account that is a member of the administrators group) and creates the correct registry keys for me in the event log, but despite this, I still get an error after starting the application with using a user identity (without his membership in administrators).

log4net:ERROR DOMConfigurator: Could not create Appender [EventLogAppender] of type [log4net.Appender.EventLogAppender]. Reported error follows.
System.Security.SecurityException: Requested registry access is not allowed.
at Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable)
at System.Diagnostics.EventLog.GetEventLogRegKey(String machine, Boolean writable)
at System.Diagnostics.EventLog.FindSourceRegistration(String source, String machineName, Boolean readOnly)
at System.Diagnostics.EventLog.DeleteEventSource(String source, String machineName)
at log4net.Appender.EventLogAppender.ActivateOptions()
at log4net.Repository.Hierarchy.DOMHierarchyConfigurator.ParseAppender(XmlElement appenderElement)
The Zone of the assembly that failed was:
MyComputer
log4net:ERROR DOMConfigurator: Appender named [EventLogAppender] not found.

I think I could narrow it down to the issue of register permission. I granted everyone full access rights to the following registry key and subkeys, but it did not work either:HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\eventlog

The user identifier is a member of the following groups:

  • Event Logs
  • IIS_USERS
  • Performance Monitor Users

, , , . Microsoft, -, ACL , SSDL, , .

EDIT: , . , , , . , MSI, . procmon ( IISReset ) . - , , 477, ( EventLog "MyCompany" ). , , "MyCompany\MyCompany.SiteCore". , , ( 6 ), Log4Net.

+5
2

, EventStores , EventStore . , , .

( ) DeleteEventSource, /, EventSource , . , MyCompany, "MyCompany\MyCompany.SiteCore", .

, , EventSource , .

, Log4net (, , ), , , .

. Microsoft

Windows Vista Windows Server 2003, .

, , . Windows Vista, ; SecurityException.

Windows Vista, (UAC) . " ", : . . , , . , , .

+4

, Apache, log4net - , , . , , , IIS , sitecore. , , , , diff, .

eventlogmessage :

C:\Windows\Microsoft.NET\Framework\v2.0.50727\EventLogMessages.dll

C:\Windows\Microsoft.NET\Framework64\v2.0.50727\EventLogMessages.dll

, , .

.

, procmon : A = , B = . , B , : Operation: RegOpenKey, Path: HKLM\System\CurrentControlSet\Services\EventLog, Desired Access:Read/Write, Result: ACCESS DENIED.

Ive A , " : ".

: , , , , , log4net. , ; node . , -, . , , . (, ).

- - , .

+2

All Articles