Register   Login
     
  Categories  
  Archive  
  Authors  
  Articles  

Current Articles | Categories | Search | Syndication

Friday, July 14, 2006
Logging to the EventLog
By Scott McCulloch @ 7:18 AM :: 1848 Views :: 8 Comments :: Article Rating :: DotNetNuke
 

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.

Rating
Comments
By Ventrian Systems @ Friday, July 14, 2006 7:35 AM
Comments from the following blog entry: Log Viewer Article, located at: http://www.ventrian.com/Resources/Blog/tabid/243/articleType/ArticleView/articleId/331/Log-Viewer-Article.aspx

By Mitupela @ Tuesday, August 29, 2006 8:44 PM
Comments from the following blog entry: External Trackback Test, located at: http://www.mitupela.net/dnn/Blog/tabid/53/articleType/ArticleView/articleId/24/External-Trackback-Test.aspx

By arjun @ Monday, April 09, 2007 4:25 AM
i am searching this type of output.Will u send me the clear information.

By arjun @ Monday, April 09, 2007 4:26 AM
i am searching this type of output.Will u send me the clear information.

By Darkware, Inc. Blog @ Tuesday, May 01, 2007 8:35 AM
Comments from the following blog entry: Writing an DNN Event Log Entry in code, located at: http://web.darkware.net:6080/portal_v4/Default.aspx?tabid=55&EntryID=18

By Darkware, Inc. Blog @ Tuesday, May 01, 2007 8:35 AM
Comments from the following blog entry: Writing an DNN Event Log Entry in code, located at: http://web.darkware.net:6080/portal_v4/Default.aspx?tabid=55&EntryID=18

By Darkware, Inc. Blog @ Tuesday, May 01, 2007 8:35 AM
Comments from the following blog entry: Writing an DNN Event Log Entry in code, located at: http://web.darkware.net:6080/portal_v4/Default.aspx?tabid=55&EntryID=18

By filemon flores @ Tuesday, July 03, 2007 12:38 AM
comment test

Click here to post a comment