Logging Events with Kentico

Developing a custom web part or module and want to log some events into the Kentico Event Log? Here is some sample code to get you started.

Logging Exceptions:

var eventLogProvider = new EventLogProvider();  
eventLogProvider.LogEvent("E", eventName, ex);

Logging Custom Events:

var eventLogProvider = new EventLogProvider();
eventLogProvider.LogEvent("E", DateTime.Now, "source", "code");

FYI, I believe that the EventLogProvider has some static methods on it to log events, but I thing they are the more verbose versions of the methods above. Happy logging!

Need hosting? I use and recommend a Digital Ocean SSD VPS server! Check out my referral link below:

Get an awesome virtual SSD server cheap!
blog comments powered by Disqus