Introducing Auditing to my application

Last post 10-22-2008 4:05 AM by Niall20. 2 replies.

Sort Posts:

  • Introducing Auditing to my application

    10-21-2008, 12:27 PM
    • Contributor
      2,516 point Contributor
    • Niall20
    • Member since 05-14-2004, 2:56 PM
    • Posts 979

    Hi all,

    I want to introduce a Auditing to my application, when a user updates, inserts or deletes data.

    I have created a table in the database for this.

    I have 2 choices of where I want to insert into the table from in my N tier application, either from the business logic layer of my application or by using a sql server trigger on the tables when they are inserted to, updated or deleted from.

    I am looking for advice as to where is the best place to record data into the Audit database table, in the application or using a trigger?

    Thanks!

  • Re: Introducing Auditing to my application

    10-21-2008, 12:43 PM
    • Star
      12,114 point Star
    • shados
    • Member since 07-07-2006, 11:24 PM
    • Posts 2,201

    Depends what kind of data you want to audit. If you have access to all you want on the database's side, triggers are probably easiest. Your app won't have to know about it, you can't "forget" some auditing, and if you want to change it, your app is unaffected.

    But if you want ASP.NET context information (like the stack trace, or the formauthentication user) without having to pass it to the database somehow, doing it in your data layer or business layer (depending on your architecture, both can be valid) is your only option.

  • Re: Introducing Auditing to my application

    10-22-2008, 4:05 AM
    • Contributor
      2,516 point Contributor
    • Niall20
    • Member since 05-14-2004, 2:56 PM
    • Posts 979

    Ok, thanks for this.

    Think I will go with the trigger approach, I will have all the data at the database layer so it might be the easiest and quickest.

    Thanks for your help.

    One final thing, any idea what I should include in an Audit table??

Page 1 of 1 (3 items)