Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Event logger in C# needs admin privileges to write logs into Windows Event Viewer?

In my C# application I am using EventLog class to log messages. It works perfectly fine on my machine but doesnt really works on client machine.

Client machine configuration is different than my machine. My machine has Vista OS whereas client has Windows 2003 OS.

I have admin rights on my machine whereas on client machine my application runs under non-admin user previleges.

On client machine I get error as Faulting application , version ,faulting module kernel32.dll

My application stopped crashing on client machine when I commented out EventLog.WriteEntry() method calls and started to write logs into simple text file.

So I was just wondering whether event logging needs administrator privileges or what?

Enviornment details : C#, .net 2.0 framework, Windows Vista, Windows 2003 server, Oracle

like image 619
Shekhar Avatar asked Oct 14 '10 06:10

Shekhar


People also ask

What does an event logger do?

Event logging provides a standard, centralized way for applications (and the operating system) to record important software and hardware events. The event logging service records events from various sources and stores them in a single collection called an event log.

How do I use event Logger?

Hover mouse over bottom left corner of desktop to make the Start button appear. Right click on the Start button and select Control Panel > System Security and double-click Administrative Tools. Double-click Event Viewer. Select the type of logs that you wish to review (ex: Application, System)

How do you write an event log?

The Write-EventLog cmdlet writes an event to an event log. To write an event to an event log, the event log must exist on the computer and the source must be registered for the event log. The cmdlets that contain the EventLog noun (the EventLog cmdlets) work only on classic event logs.


1 Answers

One solution is to create the required Event Source in your application installer, which runs with admin rights. See http://support.microsoft.com/default.aspx?scid=kb;EN-US;329291

like image 133
Bo Christian Skjøtt Avatar answered Sep 18 '22 06:09

Bo Christian Skjøtt