posted on July 14, 2006 07:18
A common technique I use to work out additional debug information for DotNetNuke modules is to log information to the event log (found at admin -> log viewer).
The advantage of this technique is that you are taking advantage of a very extensible logger and providing it in a utility familiar to the portal administrator. You can log minor events such as (person X has uploaded a picture) or to capture errors (an email failed to send, and here were the arguments in the email).
Using the event log in code is quite simple, the code is as follows:-
First, create an instance of the EventLogViewer...
Dim objEventLog As New DotNetNuke.Services.Log.EventLog.EventLogController
Next, log the event you wish to trap...
objEventLog.AddLog("Sample Message", "Something Interesting Happened!", PortalSettings, -1, DotNetNuke.Services.Log.EventLog.EventLogController.EventLogType.ADMIN_ALERT)
Now, when this code is run, the event log entry should appear in admin -> log viewer! You can customise these type of events, whether they be admin, host, item updated, etc.
It's features like this that really allow you to put together applications quickly by using features already available in the underlying framework.