[Dbix-class] Logging all SQL calls

Jesse Sheidlower jester at panix.com
Wed Mar 27 13:54:59 GMT 2019

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?

More information about the DBIx-Class mailing list