Hi all, I saw that some object.save is causing the SQL request to crash, but I don''t see the SQL request in the logs (only ruby code that''s showing an error during the .save method). Is there any way to show the SQL request before it''s issued to the database ? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
If you are working in the console you can redirect the logger to STDOUT (this is from Advanced Rails Recipes) >> ActiveRecord::Base.logger = Logger.new(STDOUT) => #<Logger:0x236aa04 @default_formatter=#<Logger::Formatter:0x236a9c8 @datetime_format=nil>, @progname=nil, @logdev=#<Logger::LogDevice: 0x236a98c @filename=nil, @mutex=#<Logger::LogDevice::LogDeviceMutex: 0x236a950 @mon_owner=nil, @mon_waiting_queue=[], @mon_entering_queue=[], @mon_count=0>, @dev=#<IO:0x2f7d8>, @shift_size=nil, @shift_age=nil>, @formatter=nil, @level=0> >> ActiveRecord::Base.clear_active_connections! => {} Best. MIke On Jul 8, 2008, at 9:07 AM, MR Damien wrote:> > Hi all, > > I saw that some object.save is causing the SQL request to crash, but I > don''t see the SQL request in the logs (only ruby code that''s showing > an > error during the .save method). > > Is there any way to show the SQL request before it''s issued to the > database ? > -- > Posted via http://www.ruby-forum.com/. > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Just to clarify: This will still issue the SQL statement but will display the SQL statement that is executed in the console. Best. Mike On Jul 8, 9:16 am, Michael Breen <hard...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> If you are working in the console you can redirect the logger to > STDOUT (this is from Advanced Rails Recipes) > > >> ActiveRecord::Base.logger = Logger.new(STDOUT) > > => #<Logger:0x236aa04 @default_formatter=#<Logger::Formatter:0x236a9c8 > @datetime_format=nil>, @progname=nil, @logdev=#<Logger::LogDevice: > 0x236a98c @filename=nil, @mutex=#<Logger::LogDevice::LogDeviceMutex: > 0x236a950 @mon_owner=nil, @mon_waiting_queue=[], > @mon_entering_queue=[], @mon_count=0>, @dev=#<IO:0x2f7d8>, > @shift_size=nil, @shift_age=nil>, @formatter=nil, @level=0> > > >> ActiveRecord::Base.clear_active_connections! > > => {} > > Best. > MIke > > On Jul 8, 2008, at 9:07 AM, MR Damien wrote: > > > > > Hi all, > > > I saw that some object.save is causing the SQL request to crash, but I > > don''t see the SQL request in the logs (only ruby code that''s showing > > an > > error during the .save method). > > > Is there any way to show the SQL request before it''s issued to the > > database ? > > -- > > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Mike Breen wrote:> Just to clarify: > > This will still issue the SQL statement but will display the SQL > statement that is executed in the console. > > Best. > MikeGreat thanks :) -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Well, sadly, the logs are showing all but the SQL requests who''s crashing :( -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I have been seeing this a bit too. Situations where a failure to updated the database does not result in an error being logged. I also think I have seen it in other circumstances too (although I suspect these may be HAML related). One circumstance whereby I did not receive a mysql error in the log was after changing some code to access a model attribute, but where that attribute had not been added to the table. But trying to subsequently reproduce the situation has not been possible. Tonypm --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
ps. As I recall, running the code in the console did result in showing the error. Tonypm --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---