これらの 3 つのリンクで提案されている行に沿って、Unicorn の構成ファイルを変更して、Unicorn のログを変更しようとしています。
- http://pivotallabs.com/how-to-split-up-rails-3-x-by-unicorn-workers/
- Rails アプリケーションの各ユニコーン ワーカーを別のファイルに記録するにはどうすればよいですか?
- https://gist.github.com/mudge/5063930
それらはすべて同じ種類のパターンに従います (私は最初のものを試しています) が、それらを構成に追加すると、Unicorn によって同じメッセージが何度も繰り返されます。
ERROR -- : uninitialized constant Unicorn::Configurator::Rails (NameError)
スタック トレースは、Unicorn ログ ファイルで Rails の最初の使用を示しています。何が間違っているのでしょうか、またはこれらのスニペットを機能させるには何を変更する必要がありますか?
Rails 3.2.14 を使用しており、次を使用してサーバーを呼び出しています。
bundle exec unicorn -c config/unicorn.rb
unicorn_rails
代わりに使用しunicorn
ても違いはありません(同じエラー)。私の設定は次のようになります:
worker_processes 20
listen ".../unicorn.socket", :backlog => 64
timeout 30
pid ...
stderr_path ...
stdout_path ...
GC.respond_to?(:copy_on_write_friendly=) and
GC.copy_on_write_friendly = true
check_client_connection false
before_fork do |server, worker|
# No code
end
after_fork do |server, worker|
defined?(ActiveRecord::Base) and
ActiveRecord::Base.establish_connection
# Snippet from the links above, error occurs within here
if defined?(ActiveSupport::TaggedLogging) && Rails.logger.kind_of?(ActiveSupport::TaggedLogging)
...
end
end