I''m having an issue with logging when I run my Rails app in production mode: script/console production Loading production environment (Rails 2.2.2)>> Rails.logger=> #<ActiveSupport::BufferedLogger:0x24e46c8 @auto_flushing=1000, @log=#<File:log/production.log>, @buffer={#<Thread:0x35700 run>=>["My logged message\n"]}, @guard=#<Mutex:0x24c0688>, @level=0>>> Rails.logger.error("hello!")=> "hello!\n">> Rails.logger=> #<ActiveSupport::BufferedLogger:0x24e46c8 @auto_flushing=1000, @log=#<File:/Users/tom/Sites/buzzsprout/log/production.log>, @buffer{#<Thread:0x35700 run>=>["Mylogged message\n", "hello!\n"]}, @guard=#<Mutex:0x24c0688>, @level=0> For some reason, messages are not being written to the log when I use the logger.error or logger.info methods. They appear in the Rails.logger @buffer? Anyone have any ideas? Thanks! Tom --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Its worth noting that the system logs just fine, it is just my logger messages that get stuck in the buffer. If I run Rails.logger.flush from the console, the messages are written correctly to the production log. Weird. On Mar 11, 4:31 pm, TomRossi7 <t...-5bxIUPmzHicFraO2wh7vUA@public.gmane.org> wrote:> I''m having an issue with logging when I run my Rails app in production > mode: > > script/console production > Loading production environment (Rails 2.2.2)>> Rails.logger > > => #<ActiveSupport::BufferedLogger:0x24e46c8 @auto_flushing=1000, > @log=#<File:log/production.log>, @buffer={#<Thread:0x35700 run>=>["My > logged message\n"]}, @guard=#<Mutex:0x24c0688>, @level=0>>> Rails.logger.error("hello!") > => "hello!\n" > >> Rails.logger > > => #<ActiveSupport::BufferedLogger:0x24e46c8 @auto_flushing=1000, > @log=#<File:/Users/tom/Sites/buzzsprout/log/production.log>, @buffer> {#<Thread:0x35700 run>=>["Mylogged message\n", "hello!\n"]}, > @guard=#<Mutex:0x24c0688>, @level=0> > > For some reason, messages are not being written to the log when I use > the logger.error or logger.info methods. They appear in the > Rails.logger @buffer? > > Anyone have any ideas? > > Thanks! > Tom--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Mar 11, 8:36 pm, tomrossi7 <t...-5bxIUPmzHicFraO2wh7vUA@public.gmane.org> wrote:> Its worth noting that the system logs just fine, it is just my logger > messages that get stuck in the buffer. If I run Rails.logger.flush > from the console, the messages are written correctly to the production > log. Weird. >The buffered log only hits disk when its flushed (which occurs either when more than X has been logged or as part of the request cycle), which isn''t going to happen by itself when you''re running from the console. Not sure what else you can do other than ensure that flush is called at some point. Fred> On Mar 11, 4:31 pm, TomRossi7 <t...-5bxIUPmzHicFraO2wh7vUA@public.gmane.org> wrote: > > > I''m having an issue with logging when I run my Rails app in production > > mode: > > > script/console production > > Loading production environment (Rails 2.2.2)>> Rails.logger > > > => #<ActiveSupport::BufferedLogger:0x24e46c8 @auto_flushing=1000, > > @log=#<File:log/production.log>, @buffer={#<Thread:0x35700 run>=>["My > > logged message\n"]}, @guard=#<Mutex:0x24c0688>, @level=0>>> Rails.logger.error("hello!") > > => "hello!\n" > > >> Rails.logger > > > => #<ActiveSupport::BufferedLogger:0x24e46c8 @auto_flushing=1000, > > @log=#<File:/Users/tom/Sites/buzzsprout/log/production.log>, @buffer> > {#<Thread:0x35700 run>=>["Mylogged message\n", "hello!\n"]}, > > @guard=#<Mutex:0x24c0688>, @level=0> > > > For some reason, messages are not being written to the log when I use > > the logger.error or logger.info methods. They appear in the > > Rails.logger @buffer? > > > Anyone have any ideas? > > > Thanks! > > Tom--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Interesting i am having the same issue with Jruby/Tomcat. Nothing is getting logged to localhost-YYYY-MM-DD.log files at all after a period of time. Is there no way to set the buffer threshold to force a flush on every log ? Adam On Wed, Mar 11, 2009 at 4:36 PM, tomrossi7 <tom-5bxIUPmzHicFraO2wh7vUA@public.gmane.org> wrote:> > Its worth noting that the system logs just fine, it is just my logger > messages that get stuck in the buffer. If I run Rails.logger.flush > from the console, the messages are written correctly to the production > log. Weird. > > On Mar 11, 4:31 pm, TomRossi7 <t...-5bxIUPmzHicFraO2wh7vUA@public.gmane.org> wrote: >> I''m having an issue with logging when I run my Rails app in production >> mode: >> >> script/console production >> Loading production environment (Rails 2.2.2)>> Rails.logger >> >> => #<ActiveSupport::BufferedLogger:0x24e46c8 @auto_flushing=1000, >> @log=#<File:log/production.log>, @buffer={#<Thread:0x35700 run>=>["My >> logged message\n"]}, @guard=#<Mutex:0x24c0688>, @level=0>>> Rails.logger.error("hello!") >> => "hello!\n" >> >> Rails.logger >> >> => #<ActiveSupport::BufferedLogger:0x24e46c8 @auto_flushing=1000, >> @log=#<File:/Users/tom/Sites/buzzsprout/log/production.log>, @buffer>> {#<Thread:0x35700 run>=>["Mylogged message\n", "hello!\n"]}, >> @guard=#<Mutex:0x24c0688>, @level=0> >> >> For some reason, messages are not being written to the log when I use >> the logger.error or logger.info methods. They appear in the >> Rails.logger @buffer? >> >> Anyone have any ideas? >> >> Thanks! >> Tom > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I got my logging to start working by adding the following to the end of my environment.rb file: Rails.logger.auto_flushing =1 I wonder if there is an issue with Rails 2.2.2 flushing the log buffer? Thanks, Tom On Mar 11, 8:37 pm, AD <straightfl...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Interesting i am having the same issue with Jruby/Tomcat. Nothing is > getting logged to localhost-YYYY-MM-DD.log files at all after a period > of time. > > Is there no way to set the buffer threshold to force a flush on every log ? > > Adam > > On Wed, Mar 11, 2009 at 4:36 PM, tomrossi7 <t...-5bxIUPmzHicFraO2wh7vUA@public.gmane.org> wrote: > > > Its worth noting that the system logs just fine, it is just my logger > > messages that get stuck in the buffer. If I run Rails.logger.flush > > from the console, the messages are written correctly to the production > > log. Weird. > > > On Mar 11, 4:31 pm, TomRossi7 <t...-5bxIUPmzHicFraO2wh7vUA@public.gmane.org> wrote: > >> I''m having an issue with logging when I run my Rails app in production > >> mode: > > >> script/console production > >> Loading production environment (Rails 2.2.2)>> Rails.logger > > >> => #<ActiveSupport::BufferedLogger:0x24e46c8 @auto_flushing=1000, > >> @log=#<File:log/production.log>, @buffer={#<Thread:0x35700 run>=>["My > >> logged message\n"]}, @guard=#<Mutex:0x24c0688>, @level=0>>> Rails.logger.error("hello!") > >> => "hello!\n" > >> >> Rails.logger > > >> => #<ActiveSupport::BufferedLogger:0x24e46c8 @auto_flushing=1000, > >> @log=#<File:/Users/tom/Sites/buzzsprout/log/production.log>, @buffer> >> {#<Thread:0x35700 run>=>["Mylogged message\n", "hello!\n"]}, > >> @guard=#<Mutex:0x24c0688>, @level=0> > > >> For some reason, messages are not being written to the log when I use > >> the logger.error or logger.info methods. They appear in the > >> Rails.logger @buffer? > > >> Anyone have any ideas? > > >> Thanks! > >> Tom--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
i can say for sure there is at least with Jruby/Tomcat running Rails. did this only effect you in production ? On Wed, Mar 11, 2009 at 11:04 PM, tomrossi7 <tom-5bxIUPmzHicFraO2wh7vUA@public.gmane.org> wrote:> > I got my logging to start working by adding the following to the end > of my environment.rb file: > > Rails.logger.auto_flushing =1 > > I wonder if there is an issue with Rails 2.2.2 flushing the log > buffer? > > Thanks, > Tom > > On Mar 11, 8:37 pm, AD <straightfl...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> Interesting i am having the same issue with Jruby/Tomcat. Nothing is >> getting logged to localhost-YYYY-MM-DD.log files at all after a period >> of time. >> >> Is there no way to set the buffer threshold to force a flush on every log ? >> >> Adam >> >> On Wed, Mar 11, 2009 at 4:36 PM, tomrossi7 <t...-5bxIUPmzHicFraO2wh7vUA@public.gmane.org> wrote: >> >> > Its worth noting that the system logs just fine, it is just my logger >> > messages that get stuck in the buffer. If I run Rails.logger.flush >> > from the console, the messages are written correctly to the production >> > log. Weird. >> >> > On Mar 11, 4:31 pm, TomRossi7 <t...-5bxIUPmzHicFraO2wh7vUA@public.gmane.org> wrote: >> >> I''m having an issue with logging when I run my Rails app in production >> >> mode: >> >> >> script/console production >> >> Loading production environment (Rails 2.2.2)>> Rails.logger >> >> >> => #<ActiveSupport::BufferedLogger:0x24e46c8 @auto_flushing=1000, >> >> @log=#<File:log/production.log>, @buffer={#<Thread:0x35700 run>=>["My >> >> logged message\n"]}, @guard=#<Mutex:0x24c0688>, @level=0>>> Rails.logger.error("hello!") >> >> => "hello!\n" >> >> >> Rails.logger >> >> >> => #<ActiveSupport::BufferedLogger:0x24e46c8 @auto_flushing=1000, >> >> @log=#<File:/Users/tom/Sites/buzzsprout/log/production.log>, @buffer>> >> {#<Thread:0x35700 run>=>["Mylogged message\n", "hello!\n"]}, >> >> @guard=#<Mutex:0x24c0688>, @level=0> >> >> >> For some reason, messages are not being written to the log when I use >> >> the logger.error or logger.info methods. They appear in the >> >> Rails.logger @buffer? >> >> >> Anyone have any ideas? >> >> >> Thanks! >> >> Tom > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---