From: Harald Krake <harald@krake.de>
To: pgsql-admin@postgresql.org
Subject: Re: Applictaion data Logging
Date: Tue, 10 Dec 2002 12:08:27 +0100
Message-ID: <at4hvc$2cp9$1@news.hub.org> (raw)
References: <3DF5492E.68E749AB@mzt.megared.net.mx>
Hi!
when it comes to portability the right place to implement such
auditing is in the OR-mapper.
Most commercial mappers already provide such a feature.
However, if you don't like "black-boxed" third party
software, writing your own mapper isn't a big deal.
It's worth the effort!
Some hints:
- writing a mapper usually ends up with methods like
MySpecialDbObject.save() or insert() or update() or alike.
- your mapper should provide a method to turn on/off logging
on a per class basis.
- one solution to the auditing problem is an extra "logging table"
per "data table". The logging table holds _all_ the columns of the
data table _plus_ a serial number (incremented each time the
corresponding data tuple is modified) and things like userid/name,
timestamp and so on.
- you should store the serial-number in the data-table too.
At least, this is how we did it and it works fine.
If you don't mind portability postgres probably provides some
auditing support, but I don't know.
Anyway, you should either use a dbms-inherent feature _or_ do it
in your application. Mixing both levels is not a good idea, imho.
Hope it helps,
Harald.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: harald@krake.de
Subject: Re: Applictaion data Logging
In-Reply-To: <at4hvc$2cp9$1@news.hub.org>
References: <3DF5492E.68E749AB@mzt.megared.net.mx> <at4hvc$2cp9$1@news.hub.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox