EventLog does not write

EventLog does not write

Post by Paperback » Fri, 13 May 2005 21:09:31

Hi, I'm trying to write a eventlog in my Application_Error but does not work
I tryed by using SmtpMail and worked fine, but the EventLog not! =[

The code:

Exception ex = Server.GetLastError().GetBaseException();
string msgErro = ex.Message;
msgErro += "\n" + ex.StackTrace;

// Create the source, if it does not already exist.
if(!System.Diagnostics.EventLog.SourceExists("MySource", "MyServer"))
System.Diagnostics.EventLog.CreateEventSource("MySource", "MyNewLog",

// Create an EventLog instance and assign its source.
System.Diagnostics.EventLog myLog = new System.Diagnostics.EventLog();
myLog.Source = "MySource";

// Write an informational entry to the event log.
myLog.Wri *** try(msgErro);


Thanks in advance,

Daniel Groh
CTF Technologies do Brasil Ltda.
Analista Programador
Fone: 11 3837-4203

EventLog does not write

Post by Sambathra » Fri, 13 May 2005 21:44:03

This happens because of permission problems. Create event log source in the
installer class of the application.


EventLog does not write

Post by Paperback » Fri, 13 May 2005 21:55:37

Sorry but how do i use this installer class ?

"Sambathraj" < XXXX@XXXXX.COM > escreveu na mensagem