Greg Hauptmann
2007-May-26 04:46 UTC
how can I disable the SQL logging which occurs in development mode?
Hi - how can I disable the SQL logging which occurs in development mode? Tks --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Bill Kocik
2007-May-26 12:46 UTC
Re: how can I disable the SQL logging which occurs in development mode?
On May 26, 12:46 am, "Greg Hauptmann" <greg.hauptmann.r...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi - how can I disable the SQL logging which occurs in development mode?In production mode you won''t see it if that''s what you''re worried about. But if you want it gone in development mode as well, put this in your config/environments/development.rb file: config.log_level = :info If you also want it gone in testing mode, you can put that in config/ environment.rb instead (or put it in both development.rb and test.rb). By default this is set to :debug, which shows the SQL queries. -Bill --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Greg Hauptmann
2007-May-26 21:01 UTC
Re: how can I disable the SQL logging which occurs in development mode?
Tks Bill - seems that the Rails framework debug code can''t easily be switched off itself then in :debug mode. I''ve had a problem trying to get "config.log_level = :info" working properly & it''s driving me nuts. Any advice would be great (I did post this separately last night but no responses yet). I have included the line "config.log_level = :info" in my environment.rbfile (and it doesn''t occur in development.rb) HOWEVER I keep getting Debug messages coming out in development mode in my development.log file. I have tried this approach in another rails project and it worked fine, however for my main project I''m working on it does not seem to filter out the Debug lines and I keep seeing them. Any ideas on how to trouble-shoot this? - how to check (perhaps through console) what the config.log_level is? - other?? Thanks On 5/26/07, Bill Kocik <bkocik-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > > > On May 26, 12:46 am, "Greg Hauptmann" <greg.hauptmann.r...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > > Hi - how can I disable the SQL logging which occurs in development mode? > > In production mode you won''t see it if that''s what you''re worried > about. But if you want it gone in development mode as well, put this > in your config/environments/development.rb file: > > config.log_level = :info > > If you also want it gone in testing mode, you can put that in config/ > environment.rb instead (or put it in both development.rb and test.rb). > > By default this is set to :debug, which shows the SQL queries. > > -Bill > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Zach Inglis // LT3media
2007-May-26 21:41 UTC
Re: how can I disable the SQL logging which occurs in development mode?
From what I can gather, you put it in environment.rb and not the sub env files; development.rb, production.rb Make sure that the function with a different result isn''t in development.rb as that''ll over-ride it, and try putting it as the last line in your environment/ development.rb Cheers, Zach Inglis → Blog -- http://www.zachinglis.com → Company -- http://www.lt3media.com → Portfolio -- http://portfolio.zachinglis.com On May 26, 2007, at 4:01 PM, Greg Hauptmann wrote:> Tks Bill - seems that the Rails framework debug code can''t easily > be switched off itself then in :debug mode. > > I''ve had a problem trying to get "config.log_level = :info" working > properly & it''s driving me nuts. Any advice would be great (I did > post this separately last night but no responses yet). > > I have included the line "config.log_level = :info" in my > environment.rb file (and it doesn''t occur in development.rb) > HOWEVER I keep getting Debug messages coming out in development > mode in my development.log file. I have tried this approach in > another rails project and it worked fine, however for my main > project I''m working on it does not seem to filter out the Debug > lines and I keep seeing them. > > Any ideas on how to trouble-shoot this? > - how to check (perhaps through console) what the config.log_level is? > - other?? > > Thanks > > > On 5/26/07, Bill Kocik <bkocik-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > On May 26, 12:46 am, "Greg Hauptmann" <greg.hauptmann.r...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > > Hi - how can I disable the SQL logging which occurs in > development mode? > > In production mode you won''t see it if that''s what you''re worried > about. But if you want it gone in development mode as well, put this > in your config/environments/development.rb file: > > config.log_level = :info > > If you also want it gone in testing mode, you can put that in config/ > environment.rb instead (or put it in both development.rb and test.rb). > > By default this is set to :debug, which shows the SQL queries. > > -Bill > > > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Greg Hauptmann
2007-May-26 22:40 UTC
Re: how can I disable the SQL logging which occurs in development mode?
I''ve tried all this (thanks), however still no luck. If I override the level in a controller seems to be my only workaround I can see. I put some logging into the rails code (in the gems area) and it''s as if the level has been set to :info at the configuration stage, but by the time the code enters my controller for the first time the level is at 0. I''m using Locomative, rails v1.2.3, ruby v1.8.5 Any ideas? =======================================g$ ruby script/server => Booting Mongrel (use ''script/server webrick'' to force WEBrick) => Rails application starting on http://0.0.0.0:3000 ************ IN RAILS - initialize_logger ************ - configuration.log_path = script/../config/../log/development.log - configuration.log_level.to_s.upcase = DEBUG - Loglevel(end) = 0 => Call with -d to detach => Ctrl-C to shutdown server ** Starting Mongrel listening at 0.0.0.0:3000 ** Starting Rails with development environment... ******* ENVIRONMENT.RB ******* - config.log_level = info ******* DEVELOPMENT.RB ******* <- I set it a 2nd time to be sure - config.log_level = info ************ IN RAILS - initialize_logger ************ ******* DEVELOPMENT.RB ******* <- seems to go back into here a 2nd time during startup - config.log_level = info ** Rails loaded. ** Loading any Rails specific GemPlugins ** Signals ready. TERM => stop. USR2 => restart. INT => stop (no restart). ** Rails signals registered. HUP => reload (without restart). It might not work well. ** Mongrel available at 0.0.0.0:3000 ** Use CTRL-C to stop. ****** ApplicationController (before mannually setting level): logger.level= 0 <- this is after I click on the URL and it enters the controller - ApplicationController: logger.level = 1 [2007-05-27 08:34:10] INFO ==================================== On 5/27/07, Zach Inglis // LT3media <lists-w8tEHcFK2X5Wk0Htik3J/w@public.gmane.org> wrote:> > From what I can gather, you put it in environment.rb and not the sub env > files; development.rb, production.rb Make sure that the function with a > different result isn''t in development.rb as that''ll over-ride it, and try > putting it as the last line in your environment/development.rb > > Cheers, > Zach Inglis > → Blog -- http://www.zachinglis.com > → Company -- http://www.lt3media.com > → Portfolio -- http://portfolio.zachinglis.com > > On May 26, 2007, at 4:01 PM, Greg Hauptmann wrote: > > Tks Bill - seems that the Rails framework debug code can''t easily be > switched off itself then in :debug mode. > > I''ve had a problem trying to get "config.log_level = :info" working > properly & it''s driving me nuts. Any advice would be great (I did post this > separately last night but no responses yet). > > I have included the line "config.log_level = :info" in my environment.rbfile (and it doesn''t occur in > development.rb) HOWEVER I keep getting Debug messages coming out in > development mode in my development.log file. I have tried this approach in > another rails project and it worked fine, however for my main project I''m > working on it does not seem to filter out the Debug lines and I keep seeing > them. > > Any ideas on how to trouble-shoot this? > - how to check (perhaps through console) what the config.log_level is? > - other?? > > Thanks > > > On 5/26/07, Bill Kocik <bkocik-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > On May 26, 12:46 am, "Greg Hauptmann" <greg.hauptmann.r...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > wrote: > > > Hi - how can I disable the SQL logging which occurs in development > > mode? > > > > In production mode you won''t see it if that''s what you''re worried > > about. But if you want it gone in development mode as well, put this > > in your config/environments/development.rb file: > > > > config.log_level = :info > > > > If you also want it gone in testing mode, you can put that in config/ > > environment.rb instead (or put it in both development.rb and test.rb). > > > > By default this is set to :debug, which shows the SQL queries. > > > > -Bill > > > > > > > > > > > > > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Greg Hauptmann
2007-May-28 20:44 UTC
Re: how can I disable the SQL logging which occurs in development mode?
PS - Here is a copy of my config files if this helps anyone see where I''m going wrong: ======== environment.rb ======== ENV[''RAILS_ENV''] ||= ''production'' require File.join(File.dirname(__FILE__), ''boot'') require ''plugins/app_config/lib/configuration'' Rails::Initializer.run do |config| puts "******* ENVIRONMENT.RB *******" config.log_level = :info puts " - config.log_level = #{config.log_level}" end ActiveRecord::Base.default_timezone = :utc LOCALES = {''en'' => ''en'', ''fr'' => ''fr''}.freeze ExceptionNotifier.exception_recipients = %w(xxxxxx) ExceptionNotifier.sender_address = %("Application Error" <xxxxx>) ExceptionNotifier.email_prefix = "[xxxxxx]" # Mail ActionMailer::Base.smtp_settings = { :address => "xxxxx", :port => 25, :domain => "xxxxx", :user_name => "xxxx", :password => "xxxx", :authentication => :login } class Logger def format_message(severity, timestamp, progname, msg) f_start = 27.chr + ''[0;34m'' f_end = 27.chr + ''[0m'' f_start + "[#{timestamp.strftime("%Y-%m-%d %H:%M:%S")}] #{severity}" + f_end + " #{msg}\n" end end ======================= ----------- development.rb --------- # Settings specified here will take precedence over those in config/environment.rb config.cache_classes = false config.whiny_nils = true config.breakpoint_server = true # Show full error reports and disable caching config.action_controller.consider_all_requests_local = true config.action_controller.perform_caching = false config.action_view.cache_template_extensions = false config.action_view.debug_rjs = true config.action_mailer.raise_delivery_errors = true # TESTING ONLY config.action_controller.consider_all_requests_local = false config.action_mailer.delivery_method = :test puts "******* DEVELOPMENT.RB *******" config.log_level = :info puts " - config.log_level = #{config.log_level}" ------------ Thanks Greg On 5/27/07, Greg Hauptmann <greg.hauptmann.ruby-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > I''ve tried all this (thanks), however still no luck. If I override the > level in a controller seems to be my only workaround I can see. > > I put some logging into the rails code (in the gems area) and it''s as if > the level has been set to :info at the configuration stage, but by the time > the code enters my controller for the first time the level is at 0. I''m > using Locomative, rails v1.2.3, ruby v1.8.5 > > Any ideas? > > =======================================> g$ ruby script/server > => Booting Mongrel (use ''script/server webrick'' to force WEBrick) > => Rails application starting on http://0.0.0.0:3000 > ************ IN RAILS - initialize_logger ************ > - configuration.log_path = script/../config/../log/development.log > - configuration.log_level.to_s.upcase = DEBUG > - Loglevel(end) = 0 > => Call with -d to detach > => Ctrl-C to shutdown server > ** Starting Mongrel listening at 0.0.0.0:3000 > ** Starting Rails with development environment... > ******* ENVIRONMENT.RB ******* > - config.log_level = info > ******* DEVELOPMENT.RB ******* <- I set it a 2nd time to be sure > - config.log_level = info > ************ IN RAILS - initialize_logger ************ > ******* DEVELOPMENT.RB ******* <- seems to go back into here > a 2nd time during startup > - config.log_level = info > ** Rails loaded. > ** Loading any Rails specific GemPlugins > ** Signals ready. TERM => stop. USR2 => restart. INT => stop (no > restart). > ** Rails signals registered. HUP => reload (without restart). It might > not work well. > ** Mongrel available at 0.0.0.0:3000 > ** Use CTRL-C to stop. > > > ****** ApplicationController (before mannually setting level): > logger.level = 0 <- this is after I click on the URL and it enters > the controller > - ApplicationController: logger.level = 1 > [2007-05-27 08:34:10] INFO > ====================================> > > On 5/27/07, Zach Inglis // LT3media <lists-w8tEHcFK2X5Wk0Htik3J/w@public.gmane.org> wrote: > > > > From what I can gather, you put it in environment.rb and not the sub env > > files; development.rb, production.rb Make sure that the function with a > > different result isn''t in development.rb as that''ll over-ride it, and > > try putting it as the last line in your environment/development.rb > > > > Cheers, > > Zach Inglis > > → Blog -- http://www.zachinglis.com > > → Company -- http://www.lt3media.com > > → Portfolio -- http://portfolio.zachinglis.com > > > > On May 26, 2007, at 4:01 PM, Greg Hauptmann wrote: > > > > Tks Bill - seems that the Rails framework debug code can''t easily be > > switched off itself then in :debug mode. > > > > I''ve had a problem trying to get "config.log_level = :info" working > > properly & it''s driving me nuts. Any advice would be great (I did post this > > separately last night but no responses yet). > > > > I have included the line " config.log_level = :info" in my > > environment.rb file (and it doesn''t occur in development.rb) HOWEVER I > > keep getting Debug messages coming out in development mode in my > > development.log file. I have tried this approach in another rails > > project and it worked fine, however for my main project I''m working on it > > does not seem to filter out the Debug lines and I keep seeing them. > > > > Any ideas on how to trouble-shoot this? > > - how to check (perhaps through console) what the config.log_level is? > > - other?? > > > > Thanks > > > > > > On 5/26/07, Bill Kocik < bkocik-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > > > > > On May 26, 12:46 am, "Greg Hauptmann" < greg.hauptmann.r...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > > wrote: > > > > Hi - how can I disable the SQL logging which occurs in development > > > mode? > > > > > > In production mode you won''t see it if that''s what you''re worried > > > about. But if you want it gone in development mode as well, put this > > > in your config/environments/development.rb file: > > > > > > config.log_level = :info > > > > > > If you also want it gone in testing mode, you can put that in config/ > > > environment.rb instead (or put it in both development.rb and test.rb). > > > > > > By default this is set to :debug, which shows the SQL queries. > > > > > > -Bill > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Isak Hansen
2007-May-29 10:59 UTC
Re: how can I disable the SQL logging which occurs in development mode?
On 5/27/07, Greg Hauptmann <greg.hauptmann.ruby-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''ve tried all this (thanks), however still no luck. If I override the > level in a controller seems to be my only workaround I can see. > > I put some logging into the rails code (in the gems area) and it''s as if the > level has been set to :info at the configuration stage, but by the time the > code enters my controller for the first time the level is at 0. I''m using > Locomative, rails v1.2.3, ruby v1.8.5 > > Any ideas? > > =======================================> g$ ruby script/server > => Booting Mongrel (use ''script/server webrick'' to force WEBrick) > => Rails application starting on http://0.0.0.0:3000 >Try again using webrick. I think there''s an issue with logger levels when running mongrel in dev mode. Isak --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Greg Hauptmann
2007-May-29 19:22 UTC
Re: how can I disable the SQL logging which occurs in development mode?
You''re exactly correct Isak! Thanks. The logging functionality worked as it should in webrick. Is seems screwed up in Mongrel. I''ll swap to using webrick in development (and try to find out where/how to let the Mongrel team about this). Interestingly I noted that with webrick the logging doesn''t come out on the console, but rather I had to open a second iTerm and tail the log file itself. Perhaps there is a "script/server webrick" setting I could use to enable logging to console if I went looking. Tks Greg On 5/29/07, Isak Hansen <isak.hansen-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > On 5/27/07, Greg Hauptmann <greg.hauptmann.ruby-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > I''ve tried all this (thanks), however still no luck. If I override the > > level in a controller seems to be my only workaround I can see. > > > > I put some logging into the rails code (in the gems area) and it''s as if > the > > level has been set to :info at the configuration stage, but by the time > the > > code enters my controller for the first time the level is at 0. I''m > using > > Locomative, rails v1.2.3, ruby v1.8.5 > > > > Any ideas? > > > > =======================================> > g$ ruby script/server > > => Booting Mongrel (use ''script/server webrick'' to force WEBrick) > > => Rails application starting on http://0.0.0.0:3000 > > > > Try again using webrick. I think there''s an issue with logger levels > when running mongrel in dev mode. > > > Isak > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Robbie Allen
2009-Feb-07 13:58 UTC
Re: how can I disable the SQL logging which occurs in develo
Does anyone know of a fix for this when running Mongrel? I have the exact same problem. Trying to disable logging in development while using Mongrel doesn''t do anything. Everything is still logged. Greg Hauptmann wrote:> You''re exactly correct Isak! Thanks. > > The logging functionality worked as it should in webrick. Is seems > screwed > up in Mongrel. I''ll swap to using webrick in development (and try to > find > out where/how to let the Mongrel team about this). > > Interestingly I noted that with webrick the logging doesn''t come out on > the > console, but rather I had to open a second iTerm and tail the log file > itself. Perhaps there is a "script/server webrick" setting I could use > to > enable logging to console if I went looking. > > Tks > Greg-- 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 -~----------~----~----~----~------~----~------~--~---
Robbie Allen
2009-Feb-20 11:50 UTC
Re: how can I disable the SQL logging which occurs in develo
Anyone? Robbie Allen wrote:> Does anyone know of a fix for this when running Mongrel? I have the > exact same problem. Trying to disable logging in development while using > Mongrel doesn''t do anything. Everything is still logged.-- 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 -~----------~----~----~----~------~----~------~--~---