我試圖將生產環境日誌保存到其他服務器上的數據庫..我的意思是,當出現一些錯誤時,我想打開ssh並檢查production.log的結尾。我想要的是去另一個數據庫(可能在其他服務器上)螞蟻檢查出來。如何將Rails日誌保存到應用程序之外的數據庫?
我想記錄的信息是相同的,因爲我在* .LOG看到,包含錯誤的代碼跟蹤,該錯誤發現行,數據庫查詢,以及HTTP響應..
像對此,
Processing Admin::WelcomeController#login (for XXX.XXX.XXX.XXX at 2010-08-27 00:02:41) [POST]
Parameters: {"username_or_email"=>"admin", "action"=>"login", "authenticity_token"=>"oPMZYGi+k/Wvxxxxxv2oNU0w34PV2KNSENuwn8=", "controller"=>"admin/welcome", "password"=>"[FILTERED]"}
Redirected to http://beta.site.com/admin/pages
Completed in 19ms (DB: 13) | 302 Found [http://beta.site.com/admin/login]
和類似的東西
Processing Admin::PagesController#edit (for 213.6.226.204 at 2010-09-02 14:18:43) [GET]
Parameters: {"action"=>"edit", "id"=>"14", "controller"=>"admin/pages"}
Rendering template within layouts/application
Rendering admin/pages/edit
ActionView::TemplateError (undefined method `include?' for nil:NilClass) on line #26 of /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/radiant-0.9.1/app/views/admin/pages/_fields.html.haml:
23: %a.popup{:href=> '#add_part_popup', :title=>t('add_part')}
24: = image('add_tab', :alt=>t('add_part'), :title=>"")
25: #pages.pages
26: = render :partial => 'admin/page_parts/page_part', :collection => @page.parts
27: = render_region :parts_bottom, :locals => {:f => fields}
28: - form.edit_layout_and_type do
29: .set
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/will_paginate-2.3.14/lib/will_paginate/finder.rb:168:in `method_missing'
radiant (0.9.1) vendor/plugins/haml/rails/./lib/haml/helpers/action_view_mods.rb:11:in `render'
radiant (0.9.1) vendor/plugins/haml/rails/./lib/haml/helpers.rb:90:in `non_haml'
radiant (0.9.1) vendor/plugins/haml/rails/./lib/haml/helpers/action_view_mods.rb:11:in `render'
radiant (0.9.1) app/views/admin/pages/_fields.html.haml:26
radiant (0.9.1) vendor/plugins/haml/rails/./lib/haml/helpers.rb:343:in `call'
radiant (0.9.1) vendor/plugins/haml/rails/./lib/haml/helpers.rb:343:in `capture_haml'
radiant (0.9.1) vendor/plugins/haml/rails/./lib/haml/helpers.rb:545:in `with_haml_buffer'
radiant (0.9.1) vendor/plugins/haml/rails/./lib/haml/helpers.rb:339:in `capture_haml'
radiant (0.9.1) vendor/plugins/haml/rails/./lib/haml/helpers/action_view_mods.rb:88:in `capture'
radiant (0.9.1) lib/radiant/admin_ui/region_partials.rb:13:in `method_missing'
radiant (0.9.1) app/views/admin/pages/_fields.html.haml:19
radiant (0.9.1) app/helpers/admin/regions_helper.rb:6:in `call'
radiant (0.9.1) app/helpers/admin/regions_helper.rb:6:in `render_region'
radiant (0.9.1) app/views/admin/pages/_fields.html.haml:6:in `_run_haml_47opt47ruby45enterprise47lib47ruby47gems47146847gems47radiant45046946147app47views47admin47pages47_fields46html46haml_locals_fields_object'
radiant (0.9.1) vendor/plugins/haml/rails/./lib/haml/helpers/action_view_mods.rb:11:in `render'
radiant (0.9.1) vendor/plugins/haml/rails/./lib/haml/helpers.rb:90:in `non_haml'
radiant (0.9.1) vendor/plugins/haml/rails/./lib/haml/helpers/action_view_mods.rb:11:in `render'
radiant (0.9.1) app/views/admin/pages/edit.html.haml:8
radiant (0.9.1) vendor/plugins/haml/rails/./lib/haml/helpers/action_view_mods.rb:204:in `call'
radiant (0.9.1) vendor/plugins/haml/rails/./lib/haml/helpers/action_view_mods.rb:204
radiant (0.9.1) vendor/plugins/haml/rails/./lib/haml/helpers.rb:567:in `call'
radiant (0.9.1) vendor/plugins/haml/rails/./lib/haml/helpers.rb:567:in `haml_bind_proc'
radiant (0.9.1) vendor/plugins/haml/rails/./lib/haml/helpers/action_view_mods.rb:210:in `form_for'
radiant (0.9.1) app/views/admin/pages/edit.html.haml:7
radiant (0.9.1) vendor/plugins/haml/rails/./lib/haml/helpers.rb:343:in `call'
radiant (0.9.1) vendor/plugins/haml/rails/./lib/haml/helpers.rb:343:in `capture_haml'
radiant (0.9.1) vendor/plugins/haml/rails/./lib/haml/helpers.rb:545:in `with_haml_buffer'
radiant (0.9.1) vendor/plugins/haml/rails/./lib/haml/helpers.rb:339:in `capture_haml'
radiant (0.9.1) vendor/plugins/haml/rails/./lib/haml/helpers/action_view_mods.rb:88:in `capture'
radiant (0.9.1) lib/radiant/admin_ui/region_partials.rb:13:in `method_missing'
radiant (0.9.1) app/views/admin/pages/edit.html.haml:6
radiant (0.9.1) app/helpers/admin/regions_helper.rb:6:in `call'
radiant (0.9.1) app/helpers/admin/regions_helper.rb:6:in `render_region'
radiant (0.9.1) app/views/admin/pages/edit.html.haml:3:in `_run_haml_47opt47ruby45enterprise47lib47ruby47gems47146847gems47radiant45046946147app47views47admin47pages47edit46html46haml'
radiant (0.9.1) vendor/plugins/haml/rails/./lib/haml/helpers/action_view_mods.rb:13:in `render'
radiant (0.9.1) vendor/plugins/haml/rails/./lib/haml/helpers/action_view_mods.rb:13:in `render'
radiant (0.9.1) vendor/plugins/haml/rails/./lib/sass/plugin/rails.rb:20:in `process'
passenger (2.2.11) lib/phusion_passenger/rack/request_handler.rb:92:in `process_request'
passenger (2.2.11) lib/phusion_passenger/abstract_request_handler.rb:207:in `main_loop'
passenger (2.2.11) lib/phusion_passenger/railz/application_spawner.rb:418:in `start_request_handler'
passenger (2.2.11) lib/phusion_passenger/railz/application_spawner.rb:358:in `handle_spawn_application'
passenger (2.2.11) lib/phusion_passenger/utils.rb:184:in `safe_fork'
passenger (2.2.11) lib/phusion_passenger/railz/application_spawner.rb:354:in `handle_spawn_application'
passenger (2.2.11) lib/phusion_passenger/abstract_server.rb:352:in `__send__'
passenger (2.2.11) lib/phusion_passenger/abstract_server.rb:352:in `main_loop'
passenger (2.2.11) lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
passenger (2.2.11) lib/phusion_passenger/abstract_server.rb:163:in `start'
passenger (2.2.11) lib/phusion_passenger/railz/application_spawner.rb:213:in `start'
passenger (2.2.11) lib/phusion_passenger/spawn_manager.rb:262:in `spawn_rails_application'
passenger (2.2.11) lib/phusion_passenger/abstract_server_collection.rb:126:in `lookup_or_add'
passenger (2.2.11) lib/phusion_passenger/spawn_manager.rb:256:in `spawn_rails_application'
passenger (2.2.11) lib/phusion_passenger/abstract_server_collection.rb:80:in `synchronize'
passenger (2.2.11) lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
passenger (2.2.11) lib/phusion_passenger/spawn_manager.rb:255:in `spawn_rails_application'
passenger (2.2.11) lib/phusion_passenger/spawn_manager.rb:154:in `spawn_application'
passenger (2.2.11) lib/phusion_passenger/spawn_manager.rb:287:in `handle_spawn_application'
passenger (2.2.11) lib/phusion_passenger/abstract_server.rb:352:in `__send__'
passenger (2.2.11) lib/phusion_passenger/abstract_server.rb:352:in `main_loop'
passenger (2.2.11) lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
Rendering /home/deploy/xxxx/public/500.html (500 Internal Server Error)
任何訣竅是歡迎:)
Amr
那麼,我知道它併爲它投票。但我希望Rails logger的功能可以完成這樣的工作。 – amrnt 2010-10-24 21:34:45