public class EventLog
{
#region Private Members
System.Diagnostics.EventLog myLog;
private string _logname = "";
#endregion
public string LogName
{
get{ return _logname; }
}
#region Constructors
public EventLog(string eventLogName)
{
_logname = eventLogName;
if(!System.Diagnostics.EventLog.SourceExists(_logn ame))
{
System.Diagnostics.EventLog.CreateEventSource(_log name, _logname);
}
myLog = new System.Diagnostics.EventLog(); //Create a new EventLog object
myLog.Source = _logname;
}
#endregion
#region Methods
public void WriteToLog(string text)
{
WriteToLog(text,System.Diagnostics.EventLogEntryTy pe.Error);
}
public void WriteToLog(string text, System.Diagnostics.EventLogEntryType
msgtype)
{
try
{
myLog.WriteEntry(text, msgtype);//Write the log
}
catch(Exception e)
{
text = e.Message;
//we should email to the system admin person
}
}
#endregion
}
"John Saunders" <johnwsaundersiii at hotmail.com> wrote in message
news:ed**************@TK2MSFTNGP14.phx.gbl...
"MattC" <m@m.com> wrote in message
news:uE**************@TK2MSFTNGP11.phx.gbl...I am able to successfully make entries into the Event Log for my Web App
but all the entries have this before my text:
The description for Event ID ( 0 ) in Source ( Conquest ) cannot be
found. The local computer may not have the necessary registry information
or message DLL files to display messages from a remote computer. You may
be able to use the /AUXSOURCE= flag to retrieve this description; see
Help and Support for details. The following information is part of the
event:
My Text here.
How are you logging the entry?
Perhaps you should supply an event id?
John Saunders