Probably I''m the only person who has been bitten by this because its a pretty sad mistake. DON''T find out what is going on in your rails app by puts''ing stuff to keep track. I know its sometimes a pain to use logger, you''re in a lib/ class, you''re in a hurry. And anyway, everything is fine! just look at Webrick''s stdout, there is the info you need! Now need to tail development.log, everything is cool. Then you deploy to fcgi and it doesn''t work! Why? it works fine on webrick, hell, *sometimes* it works under fcgi. What''s going on!?! Well, its those sneaky puts''es corrupting your headers that''s what! You have been warned! Boy, I feel dumb. Tom
A simple way to do logging is just to reference RAILS_DEFAULT_LOGGER directly. Because it is a constant, you can use it anywhere, even in lib stuff: RAILS_DEFAULT_LOGGER.debug "blah blah" And it then goes directly to your general rails log. - Jamis On Oct 25, 2005, at 4:30 PM, Tom Ayerst wrote:> Probably I''m the only person who has been bitten by this because > its a pretty sad mistake. > > DON''T find out what is going on in your rails app by puts''ing stuff > to keep track. > > I know its sometimes a pain to use logger, you''re in a lib/ class, > you''re in a hurry. And anyway, everything is fine! just look at > Webrick''s stdout, there is the info you need! Now need to tail > development.log, everything is cool. > > Then you deploy to fcgi and it doesn''t work! Why? it works fine > on webrick, hell, *sometimes* it works under fcgi. What''s going on!?! > > Well, its those sneaky puts''es corrupting your headers that''s what! > > You have been warned! > > Boy, I feel dumb. > > Tom > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
And how about $stderr.puts or .inspect? I have used those tricks(?) in development and seem to work fine (of course with Webrick). -- shanko --- Jamis Buck <jamis-uHoyYlH2B+GakBO8gow8eQ@public.gmane.org> wrote:> A simple way to do logging is just to reference RAILS_DEFAULT_LOGGER > directly. Because it is a constant, you can use it anywhere, even in > lib stuff: > > RAILS_DEFAULT_LOGGER.debug "blah blah" > > And it then goes directly to your general rails log. > > - Jamis > > On Oct 25, 2005, at 4:30 PM, Tom Ayerst wrote: > > > Probably I''m the only person who has been bitten by this because > > its a pretty sad mistake. > > > > DON''T find out what is going on in your rails app by puts''ing stuff > > to keep track. > > > > I know its sometimes a pain to use logger, you''re in a lib/ class, > > you''re in a hurry. And anyway, everything is fine! just look at > > Webrick''s stdout, there is the info you need! Now need to tail > > development.log, everything is cool. > > > > Then you deploy to fcgi and it doesn''t work! Why? it works fine > > on webrick, hell, *sometimes* it works under fcgi. What''s going on!?! > > > > Well, its those sneaky puts''es corrupting your headers that''s what! > > > > You have been warned! > > > > Boy, I feel dumb. > > > > Tom > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >__________________________________ Start your day with Yahoo! - Make it your home page! http://www.yahoo.com/r/hs
Jamis Buck <jamis-uHoyYlH2B+GakBO8gow8eQ@public.gmane.org> writes:> A simple way to do logging is just to reference RAILS_DEFAULT_LOGGER > directly. Because it is a constant, you can use it anywhere, even in > lib stuff: > > RAILS_DEFAULT_LOGGER.debug "blah blah" > > And it then goes directly to your general rails log.Does that work when using ActiveRecord stuff outside of the rails framework? -- I tend to view "truly flexible" by another term: "Make everything equally hard". -- DHH
On Oct 27, 2005, at 11:43 AM, Michael Campbell wrote:> Jamis Buck <jamis-uHoyYlH2B+GakBO8gow8eQ@public.gmane.org> writes: > >> A simple way to do logging is just to reference RAILS_DEFAULT_LOGGER >> directly. Because it is a constant, you can use it anywhere, even in >> lib stuff: >> >> RAILS_DEFAULT_LOGGER.debug "blah blah" >> >> And it then goes directly to your general rails log. >> > > Does that work when using ActiveRecord stuff outside of the rails > framework?No. It only works when using the Rails::Initializer to set up your stuff. However, there is nothing stopping you from creating a RAILS_DEFAULT_LOGGER when your app starts--it''s just not set up automatically for you. - Jamis