Skip to content
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

Ability to log sql query via boolean from Sql2o or Query classes #157

Closed
sachin-walia opened this issue Oct 5, 2014 · 2 comments
Closed

Comments

@sachin-walia
Copy link
Contributor

This is a simple request but one could avoid writing pesky log statements in multiple places to log sql query.

My take:

  1. To define it globally we can make use of Sql2o class.
  2. To define per query provide an ability in Query class.

Sql2o and Query both could provide a method something like:
setSqlLogging(boolean enable, LogLevel ..);

Log Level could decide which level should be used for logging SQL. Default could be debug / error.

@aaberg
Copy link
Owner

aaberg commented Oct 5, 2014

I like this idea very much! I will definitely add this at some point.

@aaberg
Copy link
Owner

aaberg commented Aug 11, 2015

I have added logging of the SQL just before the statement is executed. It will log the parsed query, so that parameters are logged as ?. Instead of adding a setSqlLogging() or similar, it will simply log queries at DEBUG level, so that it utilizes default logging behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants