Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #8665: remove_logger_init_and_touch_log_before_tailing.diff

File remove_logger_init_and_touch_log_before_tailing.diff, 1.1 kB (added by atnan, 6 months ago)

Removing logger initialization from Mongrel startup, and ensuring the the log file exists before tailing.

  • railties/lib/commands/servers/mongrel.rb

    old new  
    3434 
    3535puts "=> Rails application starting on http://#{OPTIONS[:ip]}:#{OPTIONS[:port]}" 
    3636 
    37 parameters = [  
    38   "start",  
    39   "-p", OPTIONS[:port].to_s,  
    40   "-a", OPTIONS[:ip].to_s,  
     37parameters = [ 
     38  "start", 
     39  "-p", OPTIONS[:port].to_s, 
     40  "-a", OPTIONS[:ip].to_s, 
    4141  "-e", OPTIONS[:environment], 
    4242  "-P", "#{RAILS_ROOT}/tmp/pids/mongrel.pid" 
    4343] 
     
    5050 
    5151  start_debugger if OPTIONS[:debugger] 
    5252 
    53   require 'initializer' 
    54   Rails::Initializer.run(:initialize_logger) 
    55  
    5653  puts "=> Call with -d to detach" 
    5754  puts "=> Ctrl-C to shutdown server" 
    58   tail_thread = tail(Pathname.new("#{File.expand_path(RAILS_ROOT)}/log/#{RAILS_ENV}.log").cleanpath) 
    5955 
     56  log = Pathname.new("#{File.expand_path(RAILS_ROOT)}/log/#{RAILS_ENV}.log").cleanpath 
     57  open(log, (File::WRONLY | File::APPEND | File::CREAT)) unless File.exist? log 
     58  tail_thread = tail(log) 
     59 
    6060  trap(:INT) { exit } 
    6161 
    6262  begin