Bug 16329

Summary: Koha::Logger->sql(). Unified interface to log SQL statements OR use DBIx::Log4perl
Product: Koha Reporter: Olli-Antti Kivilahti <olli-antti.kivilahti>
Component: Architecture, internals, and plumbingAssignee: Olli-Antti Kivilahti <olli-antti.kivilahti>
Status: In Discussion --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: katrin.fischer, srdjan
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 16313    
Bug Blocks:    
Attachments: Bug 16329 - Koha::Logger->sql(). Unified interface to log SQL statements

Description Olli-Antti Kivilahti 2016-04-24 13:20:02 UTC
Instead of whenever needing to log SQL statements, making a custom logging output/function, introduce a centralized subroutine to handle all sql-statement logging.

How the SQL-statements should be logged remains to be seen, but currently simply presenting very simple formatting we can discuss about.

SQL libraries (DBI, DBIx) also allow logging SQL-statements but lack the fine-grained control Log4perl offers.


Or maybe Log4perl can be integrated better to DBI / DBIx with this:
https://metacpan.org/pod/DBIx::Log4perl

Because I am not a huge fan of DBIx and also integrating that to Koha::Object is a lot of work, will not pursue that track further.
Comment 1 Olli-Antti Kivilahti 2016-04-24 13:22:29 UTC
Created attachment 50599 [details] [review]
Bug 16329 - Koha::Logger->sql(). Unified interface to log SQL statements

Instead of whenever needing to log SQL statements, making a custom logging
output/function, introduce a centralized subroutine to handle all
sql-statement logging.

How the SQL-statements should be logged remains to be seen, but currently
simply presenting very simple formatting we can discuss about.
Comment 2 Srdjan Jankovic 2016-06-01 02:30:17 UTC
Ok, let's discuss. I would at least suggest prefixing with "SQL:" or similar for parsing/grepping purposes
Comment 3 Katrin Fischer 2017-10-15 09:41:43 UTC
Marking in Discussion because of Srdjan's last comment.

Please note, there is a complex dependency tree here, some of the dependent patches are Failed QA atm.