When you run your program as a normal user can you write to the EventLog 
without using log4net?



----- Original Message ----
From: rodchar <rodc...@hotmail.com>
To: log4net-dev@logging.apache.org
Sent: Wednesday, February 18, 2009 4:45:22 PM
Subject: log4net event logging appender


http://www.nabble.com/file/p22088962/log4tester.PNG log4tester.PNG 

hi all,

i have the simplest console app to test the eventlog appender.

http://www25.brinkster.com/rodchar/log4net.htm image of windiff 

Initially, if i run the app as a user the event log won't work. However, if
i run the app as an admin, it successfully writes to the event log. Then
when i run the app again as a user it will log to the event log (unlike
before). can someone please explain this?

Console Messages: 

************* Run As User *****************************
log4net:ERROR DOMConfigurator: Could not create Appender [EventLogAppender]
of t
ype [log4net.Appender.EventLogAppender]. Reported error follows.
System.Security.SecurityException: The source was not found, but some or all
eve
nt logs could not be searched.  Inaccessible logs: Security.
   at System.Diagnostics.EventLog.FindSourceRegistration(String source,
String m
achineName, Boolean readOnly)
   at System.Diagnostics.EventLog.SourceExists(String source, String
machineName
)
   at System.Diagnostics.EventLog.SourceExists(String source)
   at log4net.Appender.EventLogAppender.ActivateOptions()
   at
log4net.Repository.Hierarchy.DOMHierarchyConfigurator.ParseAppender(XmlEle
ment appenderElement)
The Zone of the assembly that failed was:
MyComputer
log4net:ERROR DOMConfigurator: Appender named [EventLogAppender] not found.

************* Run As Admin *****************************
log4net: EventLogAppender: Creating event source Source [log4netTester.exe]
in l
og Application]
log4net: EventLogAppender: Source [log4netTester.exe] is registered to log
[Appl
ication]
log4net: DOMConfigurator: Created Appender [EventLogAppender]
log4net: DOMConfigurator: Adding appender named [EventLogAppender] to logger
[ro
ot].


thanks,
rodchar
-- 
View this message in context: 
http://www.nabble.com/log4net-event-logging-appender-tp22088962p22088962.html
Sent from the Log4net - Dev mailing list archive at Nabble.com.

Reply via email to