[Dbix-class] Logging all SQL calls

Tom Bloor tom.bloor at gmail.com
Wed Mar 27 14:18:29 GMT 2019


Hi Jesse,

Ive used DBIx::Class::AuditAny successfully for data level auditing, with
an added user column for tracking who did what. Ive popped it in a gist
here:

https://gist.github.com/TBSliver/caaf87d7165c53e2e55cdffb47c2fefc

If you want something other than data level auditing then I dont know what
would work for that, but this is atleast a good starting point! The docs do
mention using a file to dump the data, so the DBIC stuff may be irrelevant
to you though:

https://metacpan.org/pod/DBIx::Class::AuditAny#coderef-collector-to-a-file

Thanks,

Tom

On Wed, 27 Mar 2019 at 13:55, Jesse Sheidlower <jester at panix.com> wrote:

>
> I think I asked about this a while ago on IRC, but I lost track of the
> discussion....
>
> I have a large Catalyst app that uses DBIx::Class. We've had a few issues
> where we need to see an audit log. In some cases we can re-run an action on
> a staging server with DBIC_TRACE enabled, but in other cases we really need
> to see what happened on the production machine.
>
> Is there an easy way to log either all the database-changing statements,
> or all SQL period? Obviously the latter would be huge, but might be worth
> it.
>
> I've seen DBIx::Class::AuditLog, which requires that relevant statements
> be wrapped in a transaction, and DBIx::Class::QueryLog, which seems to be
> intended for debugging purposes only. I need something that just takes
> everything and logs it to a text file, without having to rewrite the entire
> codebase. How do I accomplish this?
>
> _______________________________________________
> List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
> Searchable Archive:
> http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20190327/1037a788/attachment.htm>


More information about the DBIx-Class mailing list