Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id C55A64759AF for ; Tue, 10 Dec 2002 06:08:29 -0500 (EST) Received: from news.hub.org (news.hub.org [64.49.215.80]) by postgresql.org (Postfix) with ESMTP id 55A11474E44 for ; Tue, 10 Dec 2002 06:08:29 -0500 (EST) Received: by news.hub.org (Postfix, from userid 8) id 3787B43A776; Tue, 10 Dec 2002 06:08:29 -0500 (EST) From: Harald Krake X-Newsgroups: comp.databases.postgresql.admin Subject: Re: Applictaion data Logging Date: Tue, 10 Dec 2002 12:08:27 +0100 Organization: Krake Softwaretechnik Lines: 30 Message-ID: References: <3DF5492E.68E749AB@mzt.megared.net.mx> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Complaints-To: usenet@news.hub.org User-Agent: KNode/0.7.1 To: pgsql-admin@postgresql.org X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/145 X-Sequence-Number: 6640 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.