It''s probably a begginers question...but, in a controller I have: logger = Logger.new(STDOUT) logger.info "Testing logger at controller" When running my app in my machine, I can see this log in log/development.log file. When running in production, this log is not printed. Not even with "puts" ... Info is the default level for Logger when running in production...so...Why can''t I see my logs in production environmnent ? Any help ? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Apr 4, 7:07 pm, Anderson Leite <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> It''s probably a begginers question...but, in a controller I have: > > logger = Logger.new(STDOUT) > logger.info "Testing logger at controller" > > When running my app in my machine, I can see this log in > log/development.log file. > > When running in production, this log is not printed. Not even with > "puts" ...I don''t think STDOUT is connected to anything in particular in production (since typically the process will have detached from the terminal that launched it) If you just want to write to the standard log file why do you need to create your own logger? Fred> > Info is the default level for Logger when running in > production...so...Why can''t I see my logs in production environmnent ? > Any help ? > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
What''s the best way to initialize logger and where to do it ? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
well.. To log a message from either a controller or a model, access the Rails logger instance with the logger method: class HomeController < ActionController::Base def index logger.info ''informational message'' end end From outside a controller or model, you can pass the logger instance or access it with the constant RAILS_DEFAULT_LOGGER. Since Rails 2.1, you can also access it with the shortcut Rails.logger. In an initializer file, Rails.logger is the best way to log ? 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.