p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: ASP.NET Website Programming Problem-Design-Solution (http://p2p.wrox.com/forumdisplay.php?f=23)
-   -   AppException Class -Log Error to Event Log (http://p2p.wrox.com/showthread.php?t=21846)

bekim November 29th, 2004 07:56 AM

AppException Class -Log Error to Event Log
 
Hello
I used the code in book, page 40, to get error to actually log the info to event log but it just doesn't work.
AppException.vb in Core


Private Sub LogEvent(ByVal message as String)
If Not EventLog.SourceExist("ThePhile.com") Then
EventLog.CreateEventSource("ThePhile.com"), "Application")
end if

EventLog.WriteEntry("ThePhile.com", message, EventLogEntryType.Error)
End Sub

What could be the problem??[B)]


Mykre November 29th, 2004 04:55 PM

I would check the user that the web application is running under, By default the ASP worker Account does not have permissions to create event sources.


bekim November 30th, 2004 06:32 AM

Mykre, could you give me more details about ASP worker Account not having permission to create event source.
How can I get ASP.NET to have these permissions???


Mykre November 30th, 2004 05:09 PM

You can not!, you need to create an account that has permissions that can access the registry and eventlogs.

My suggestion though is to create the eventlog sources and any custome event logs during setup, there is an article on MSDN that can help with this.


englere December 1st, 2004 08:20 AM

You can also read the other messages in this forum, or check the readme.htm file in the code download. This is a frequent question.

Eric

Jongog December 3rd, 2004 08:00 AM

If you build a website and host it on a server you do not own you cannot get access to the event log. Has anyone changed the code in the log event method so that it logs the event to a SQLserver database instead?

John


englere December 6th, 2004 07:02 PM

SQL Server logging is not a good idea because many of the problems that get logged are related to DB trouble.

The VB.NET code download has been modified to log to a file, and this is what I prefer.

Eric

Jongog December 7th, 2004 01:01 PM

Thanks Eric,
I hadn't thought of that
I am going to stick to writing to a file

John



All times are GMT -4. The time now is 03:36 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.