Showing posts with label event-viewer. Show all posts
Showing posts with label event-viewer. Show all posts

Wednesday, January 21, 2009

Grant Event Log permissions to an account

On Windows 2003 Server
go to HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\EventLog:



Then add permissions to a specific account.

related link: http://blogs.objectsharp.com/cs/blogs/bruce/archive/2003/11/03/180.aspx

Wednesday, November 28, 2007

How to write to the Event Viewer

from http://support.microsoft.com/kb/307024

using System.Diagnostics;

...
WriteToEventViewer("MOSS-CRM Webservice", "Application", "User provided is invalid");

...

private void WriteToEventViewer(string sSource, string sLog, string sEvent)
{
if (!EventLog.SourceExists(sSource))

EventLog.CreateEventSource(sSource, sLog);

EventLog.WriteEntry(sSource, sEvent, EventLogEntryType.Warning, 234);
}

Also:

System.Diagnostics.EventLog eventLog = new System.Diagnostics.EventLog("Application");

eventLog.Source = "Rtws";

eventLog.WriteEntry(ex.ToString(), System.Diagnostics.EventLogEntryType.Error);




end