[Dbix-class] Logging all SQL calls

David Cantrell david at cantrell.org.uk
Wed Mar 27 15:36:36 GMT 2019


On Wed, Mar 27, 2019 at 09:54:59AM -0400, Jesse Sheidlower wrote:

> 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?

DBIx::Class::QueryLog is easy to sub-class, so you could write one that
you load, and then it just writes to a file instead of remembering
stuff. I believe you'd just need to over-ride query_end (to make it
write the file and prevent it from remembering stuff) and quary_class()
which is just an implementation detail.

-- 
David Cantrell | Hero of the Information Age

  Irregular English:
    you have anecdotes; they have data; I have proof



More information about the DBIx-Class mailing list