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? Easily deploy an SSD cloud server on Digital Ocean in 55 seconds. Sign up using my link and receive $10 in credit!

blog comments powered by Disqus