Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Using EventLogProvider.LogEvent Does Nothing View modes: 
User avatar
Member
Member
Armysniper89 - 11/11/2010 2:17:07 PM
   
Using EventLogProvider.LogEvent Does Nothing
I am working in a clone of the CustomRegistration web part and after the user is registered I do some work to add them to a third party Email Marketing firm we are using. When the code completes, I wanted to write an EventLog entry that has a description with some of the information returned from the third party service...I created an instance of EventProvider and called LogEvent like this:

eventLog.LogEvent("I", DateTime.Now, "Registration", "Constant Contact Update", string.Empty, "User Details BEFORE Update: " + detailsXml);


detailsXml is a string that contains the XML details of the user's record in our third part service (Constant Contact). It should help me in debugging if there are issues so I wanted to store it in the description. Am I missing something here?

User avatar
Member
Member
Armysniper89 - 11/11/2010 2:29:08 PM
   
RE:Using EventLogProvider.LogEvent Does Nothing
Never mind. The code actually works! It just took a second or two for the event to trigger. Works good except that the XML stored in that "detailsXml" value comes in as a mess. I will have to find a better way to store that and send it to the event log.

User avatar
Kentico Support
Kentico Support
kentico_zdenekc - 11/12/2010 8:00:25 AM
   
RE:Using EventLogProvider.LogEvent Does Nothing
Hi,

glad to hear the code works. It may take few seconds before it's triggered.

As for the formatting, it depends on how exactly does the xml structure look like.

You could use some methods from HTMLHelper class to format the event description data.
Listing some useful methods: HTMLEncode, HTMLEncodeLineBreaks, EnsureLineEnding...


Regards,
Zdenek