Created
September 19, 2014 03:59
-
-
Save jhjguxin/e1186903b514c66a55b8 to your computer and use it in GitHub Desktop.
how to config log level within production env rails + unicorn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set to :debug to see everything in the log. | |
config.log_level = ENV["LOG_LEVEL"].present? ? ENV["LOG_LEVEL"] : :info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
before_fork do |server, worker| | |
ENV["LOG_LEVEL"] = "debug" | |
old_pid = "#{app_path}/tmp/pids/unicorn.pid.oldbin" | |
if File.exists?(old_pid) && server.pid != old_pid | |
begin | |
Process.kill("QUIT", File.read(old_pid).to_i) | |
rescue Errno::ENOENT, Errno::ESRCH | |
puts "Send 'QUIT' signal to unicorn error!" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment