提交 437f9186 编写于 作者: M Michael Koziarski

Allow custom loggers to work with script/server.

Instead of requiring the initializer and initializing the logger, create the file manually before tailing it.

[atnan] Closes #8665 (trac)
上级 205750c8
......@@ -34,10 +34,10 @@
puts "=> Rails application starting on http://#{OPTIONS[:ip]}:#{OPTIONS[:port]}"
parameters = [
"start",
"-p", OPTIONS[:port].to_s,
"-a", OPTIONS[:ip].to_s,
parameters = [
"start",
"-p", OPTIONS[:port].to_s,
"-a", OPTIONS[:ip].to_s,
"-e", OPTIONS[:environment],
"-P", "#{RAILS_ROOT}/tmp/pids/mongrel.pid"
]
......@@ -50,12 +50,12 @@
start_debugger if OPTIONS[:debugger]
require 'initializer'
Rails::Initializer.run(:initialize_logger)
puts "=> Call with -d to detach"
puts "=> Ctrl-C to shutdown server"
tail_thread = tail(Pathname.new("#{File.expand_path(RAILS_ROOT)}/log/#{RAILS_ENV}.log").cleanpath)
log = Pathname.new("#{File.expand_path(RAILS_ROOT)}/log/#{RAILS_ENV}.log").cleanpath
open(log, (File::WRONLY | File::APPEND | File::CREAT)) unless File.exist? log
tail_thread = tail(log)
trap(:INT) { exit }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册