Logging to different database

Sjoerd de Wildt asked on December 5, 2014 14:25

I was wondering if it would be possible to save the event logs to a different database than the Kentico database?

So, instead of all logs are saved to the table CMS_EventLog, they should be saved to a different database and table.

Correct Answer

Brenden Kehren answered on December 5, 2014 14:58

I don't believe there is any setting or property for that to happen. You do have some options though:

  • Create a scheduled task that runs say every 5 or 10 minutes and grabs all the events and writes them to the other database, then delete them from Kentico.
  • Use the web.config key (<add key="CMSLogEventsToFile" value="true"/>) setting to log the events to the file system and parse out the file to your other database with some other code. Believe this still logs the events to the Kentico table though.

Either option, you need to write to the Kentico table first and then manage them from that table or file. There may be a global handler you could write as well but I think the first option is the simplest and most manageable.

1 votesVote for this answer Unmark Correct answer

Recent Answers

Sjoerd de Wildt answered on December 5, 2014 15:36

I already had a feeling this would be the kind of answer.

But thank you anyway! Still needed some confirmation.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.