Hi, In my controller I have given: logger = Logger.new(''try.log'', shift_age=''daily'') A file is created in the root folder of my application as try.log. But if I give logger.info(''testing'') then this is logged in development.log instead of try.log. Am I missing some setup? -- 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 want a controller specific logger, you should over-write the the inherited @logger attribute and provide an accessor for it. attr_accessor :logger def initialize super @logger = Logger.new(''try.log'') end ... If you want a rails-wide logger over-ride, you''ll need to do it in config/environment* One caveat -- in clustered setups using Ruby-specific log rotation is a huge no-no and will cause you massive headaches in the future. You should rely on some sort of external log rotation solution (logrotate, etc) for those. On Mar 9, 5:31 am, Rm Rm <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hi, > > In my controller I have given: > > logger = Logger.new(''try.log'', shift_age=''daily'') > > A file is created in the root folder of my application as try.log. > > But if I give logger.info(''testing'') then this is logged in > development.log instead of try.log. Am I missing some setup? > > -- > 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 -~----------~----~----~----~------~----~------~--~---
Can you point me as to where I can get an idea of external log rotation? -- 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 -~----------~----~----~----~------~----~------~--~---
There are a few packages out there. This is what I use: http://iain.cx/src/logrotate/ On Mar 9, 10:19 am, Rm Rm <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Can you point me as to where I can get an idea of external log rotation? > > -- > 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 -~----------~----~----~----~------~----~------~--~---