-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Add support for 'traceQueries' DSN configuration parameter #445
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
a653cba
to
72940f5
Compare
Why do you want to do this in driver level instead of higher level? |
72940f5
to
3260325
Compare
@methane I am using packages that wrap the driver and I am using the driver itself; by printing the information I need just before it's actually being executed I have a convenient central location from where to collect it; but I think that's obvious already? |
97fb693
to
ee2f46b
Compare
For example, gorp have logging feature. Since DSN limitation, it's difficult to configure logging. (format, logger, etc...) |
I agree, this should better be at I am looking at a general solution that allows me to capture all interactions of my Go application with the MySQL server. Alternatively, one could write a shim package for |
FYI: This pull request doesn't log query executed without prepared statement. |
@methane I will fix that, thanks for reporting |
f62309e
to
4c088bd
Compare
3e4d431
to
15a568f
Compare
FYI I have just re-based & squashed this PR |
Add some missing debugging for query/exec methods Print information about MySQL connection involved
15a568f
to
4e1bd7d
Compare
@gm42 https://github.com/mailru/dbr has instruments to trace queries and it is driver agnostic. |
Use https://github.com/luna-duclos/instrumentedsql which is able to wrap any driver for logging or other use cases. |
Description
This is a proposal for a way to trace each and every SQL query being executed by the driver. I do not expect it to be merged in its current form but rather please give me some feedback about how to achieve the purpose:
Right now I am printing them to
errLog
, although I'd possibly use a separate logger (as these are not really errors). It's also a common desire to be able to turn on/off the feature at runtime, which would require yet another mutex (I am not particularly happy about the one introduced here either).Checklist
Edit: renamed the parameter from debugQueries to traceQueries