Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Using EventLogController and LogInfoUsing EventLogController and LogInfo
Previous
 
Next
New Post
2/23/2009 10:42 AM
 

I've been attempting to track down a problem in a piece of code all weekend :(

I have a very straight forward piece of code that manipulates data.  There isn't an IF or loop or anything in the area I'm working on. The problem is...  This code is failing when I pass production volumes of data thru it - and it fails at different spots. I originally wanted to trace the code in a debugger...  But the code doesn't fail unless I pass production volumes thru, and sitting waiting for the debugger to locate an exception is a pain!  My alternate is to put some Logging into my code and turn it loose on the production volumes of data.

At the top of the code in question, I created a LogInfo variable and an EventLogController.  Both VB variables were DIM'd and initialized.

There are 4 places in the code I want to see what's happening.  In each spot, I placed code similar to:

 

' preconfig LogInfo info

objEventLogInfo.LogTypeKey = EventLogController.EventLogType.USER_CREATED.ToString()

objEventLogInfo.BypassBuffering =

True

objEventLogInfo.LogProperties.Clear()

objEventLogInfo.LogProperties.Add(

New LogDetailInfo("Counter is ", _list.Count))

objEventLogController.AddLog(objEventLogInfo)

' Write log entry

 

The first of the 4 Event Log entries is written perfectly.  The second fails with:

Error   Violation of PRIMARY KEY constraint 'PK_EventLogMaster'. Cannot insert duplicate key in object 'dbo.EventLog'. The statement has been terminated.

 

As far as I can tell, this error is caused by the EventLogController having allocated a GUID when this object was created.  But, because I'm "reusing" this object, the GUID doesn't get replaced.  I looked at the code a bit and didn't see a method I can call that will generate a new GUID.

I did a search of the DNN 5 source tree and didn't find a single case of EventLogController being "reused" within a module.  The code I saw allocated both EventLogController and LogInfo and wrote data - either as part of an IF or as the sole logging event within a method. In each case I found, both EventLogController and LogInfo are created anew before they are used.

 

Anyone know if it's possible to reuse an EventLogController object?  And how to generate a new GUID - so I don't get DataBase errors?

 

Thanks!

 

Robert

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Using EventLogController and LogInfoUsing EventLogController and LogInfo


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out