Posted by: Benoit Dubuc | 2010/10/22

Need your input: how to log actions in the fastest fashion?

I am currently working on a project where a lot of things will need to be logged, so the customer can have some reports.  Basically, this will be a web site where each time a specific document appears in a search result, it will need to be logged.  I will also need to log when when ever a link is clicked.  Also, some publicity will appear on the site and I need to track how often each add was displayed.

For now, I am hesitating between two solutions: logging everything in the web site database and have an hourly agent that will move all log entries to the log database.  option two is using OpenLog from OpenNTF.  The biggest concern here is performance: is it better to write in the current database or writing in a different database is not a big performance hit.

This site will not get zillions of hits a day, but planning in case it does, do you have any related experience to relate?  Any opinions on this matter?

As usual, all your help is greatly appreciated.



  1. You really can´t go wrong with OpenLog . i give it my vote.

  2. Generally i would say to create the log documents directly in a separate database. You may loose some performance with the repeated opening before writing, but creating a lot of documents in a database only to move them away later has a greater impact. Keep in mind that this action triggers view updates in your current database and a large number of deletion stubs are bad for view performance as well.

    If you want use the “Agent profile”-function to exactly measure how long it takes for your script to open the other database.

    OpenLog is great, but it gathers for each logged event also a LOT of additional data. This is also time consuming and in your case may result in always the same values. A simple logging will be much faster.

    But i’d suggest to do some quick testing of writing a 1000 entries and really measure the differences.
    And remember i may be wrong 🙂

  3. I’m voting for logging directly to the separate database as well.

    If you logged into the main DB, then you’ll have performance impacts from deletion stubs, etc. Overall, there are very few situations where it’ll be slower.

    OpenLog is the best, but if this is a very busy application, you may want to do custom logging that only writes the exact info you want to track. But that’d be a rare scenario.

    Overall, I’d vote for OpenLog to a separate DB – that should serve you well.

  4. I’d also go with OpenLog, to different DB. If you found that the standard OpenLog classes were too slow, you could always “extend” them and just log what you need whilst retaining all the config part of the OpenLog classes.

    I use OpenLog on pretty much every single project.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: