lightyear / sql-logging Goto Github PK
View Code? Open in Web Editor NEWAdds SQL analysis and debugging information to Rails 3.x, 4.x apps.
License: MIT License
Adds SQL analysis and debugging information to Rails 3.x, 4.x apps.
License: MIT License
sql-logging-3.0.2/lib/sql-logging/logged_query.rb:23: syntax error, unexpected ':', expecting keyword_then or ',' or ';' or '\n' (SyntaxError)
when :sql: @Sql
Using ruby 1.9.2 and rails 3.0.3
I installed the gem and put gem 'sql-logging' in my gem file. When I booted up the server I get the following error:
/home/jthullbery/.rvm/gems/ruby-1.9.2-p180/gems/sql-logging-3.0.3/lib/sql-logging/statistics.rb:5:in <class:Helper>': uninitialized constant SqlLogging::Helper::Singleton (NameError) from /home/jthullbery/.rvm/gems/ruby-1.9.2-p180/gems/sql-logging-3.0.3/lib/sql-logging/statistics.rb:4:in
module:SqlLogging'
from /home/jthullbery/.rvm/gems/ruby-1.9.2-p180/gems/sql-logging-3.0.3/lib/sql-logging/statistics.rb:3:in <top (required)>' from /home/jthullbery/.rvm/gems/ruby-1.9.2-p180/gems/sql-logging-3.0.3/lib/sql-logging/railtie.rb:1:in
require'
from /home/jthullbery/.rvm/gems/ruby-1.9.2-p180/gems/sql-logging-3.0.3/lib/sql-logging/railtie.rb:1:in <top (required)>' from /home/jthullbery/.rvm/gems/ruby-1.9.2-p180/gems/sql-logging-3.0.3/lib/sql-logging.rb:1:in
require'
from /home/jthullbery/.rvm/gems/ruby-1.9.2-p180/gems/sql-logging-3.0.3/lib/sql-logging.rb:1:in <top (required)>' from /home/jthullbery/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.10/lib/bundler/runtime.rb:68:in
require'
from /home/jthullbery/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.10/lib/bundler/runtime.rb:68:in block (2 levels) in require' from /home/jthullbery/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.10/lib/bundler/runtime.rb:66:in
each'
from /home/jthullbery/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.10/lib/bundler/runtime.rb:66:in block in require' from /home/jthullbery/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.10/lib/bundler/runtime.rb:55:in
each'
from /home/jthullbery/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.10/lib/bundler/runtime.rb:55:in require' from /home/jthullbery/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.10/lib/bundler.rb:120:in
require'
from /home/jthullbery/Documents/teladoc/netsoft/business/config/application.rb:7:in <top (required)>' from /home/jthullbery/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.5/lib/rails/commands.rb:28:in
require'
from /home/jthullbery/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.5/lib/rails/commands.rb:28:in block in <top (required)>' from /home/jthullbery/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.5/lib/rails/commands.rb:27:in
tap'
from /home/jthullbery/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.5/lib/rails/commands.rb:27:in `<top (required)>'
alias_method_chain
is now deprecated and no longer works in Rails 5.1; therefore the gem is incompatible with Rails 5.1. There is at least one place where it is using the deprecated method, and it needs to be refactored to use an alternative. For reference this is the error when trying to use sql-logging
with rails 5.1:
/Users/fabiano/.rvm/gems/ruby-2.3.1@clouddentistry/gems/sql-logging-3.0.10/lib/sql-logging/adapters/cache_extension.rb:20:in `<module:QueryCache>': undefined method `alias_method_chain' for ActiveRecord::ConnectionAdapters::QueryCache:Module (NoMethodError)
Did you mean? alias_method
I'm taking a look at the code and maybe I can create a PR to fix it. Is this gem still maintained?
3.0.9 is locking the Rails version to < 5 even that in the commit that bump the gem to that version the gemspec doesn't have that lock. I guess it was manually built when released.
Can we have a new release?
The gem has no automated tests to ensure that it works properly with the various versions of Rails it claims to support.
Hi there!
First of all thanks for this gem, it's been my trusty tool for some 3 years!
Lately I started using it for Rails 5 and I noticed it doesn't backtrace the origin code path for a given query, anymore
What could have changed with Rails 5?
I run it 'out of the box' and got this:
2.1.1-railsexpress :004 > job.save
(28.9ms) BEGIN
7 rows, 258 Bytes
Jail Load (31.6ms) SELECT "jails".* FROM "jails" WHERE "jails"."email" = $1 LIMIT 1 [["email", "[email protected]"]]
0 rows, 0 Bytes
5 rows, 178 Bytes
1 row, 2 Bytes
Skill Load (30.8ms) SELECT "skills".* FROM "skills" INNER JOIN "job_skills" ON "skills"."id" = "job_skills"."skill_id" WHERE "job_skills"."job_id" = $1 [["job_id", 27]]
1 row, 74 Bytes
6 rows, 227 Bytes
(28.3ms) ROLLBACK
=> false
2.1.1-railsexpress :005 >
On Rails 4.2.0 with PostgreSQL.
Am I doing something wrong?
The README states that
This gem is for Rails 4+ only. It supports MySQL (including the mysql2 gem), PostgreSQL and SQLite.
but the repo's tagline states
Adds SQL analysis and debugging information to Rails 3.x, 4.x apps.
I suspect the README is correct and the tagline is false, but
I'm running Ruby 1.9.2 on Rails 3.2.0 against Postgresql.
After adding this Gem to my Gemfile, and bundle install, bundle exec rails server, I am greeted with the wonderful message:
/Users/me/.rvm/gems/ruby-1.9.2-p290@name/gems/sql-logging-3.0.6/lib/sql-logging/adapters/postgresql.rb:7:in `block in execute_with_sql_logging': undefined local variable or method `name' for #<ActiveRecord::ConnectionAdapters::PostgreSQLAdapter:0x007faac69e44b8> (NameError)
And then my application crashes.
Of at leas 3.1.3 gives me this error:
ArgumentError in OwnersController#show
wrong number of arguments (3 for 2)
Rails.root: /var/web/kub.cz/ucet/sites/ucet-test
Application Trace | Framework Trace | Full Trace
activerecord (3.1.3) lib/active_record/connection_adapters/abstract/database_statements.rb:18:in select' activerecord (3.1.3) lib/active_record/connection_adapters/abstract/database_statements.rb:18:in
select_all'
activerecord (3.1.3) lib/active_record/connection_adapters/abstract/query_cache.rb:61:in select_all' activerecord (3.1.3) lib/active_record/connection_adapters/abstract/query_cache.rb:75:in
cache_sql'
activerecord (3.1.3) lib/active_record/connection_adapters/abstract/query_cache.rb:61:in `select_all'
any idea?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.