我已经尝试调用
logger.debug
和Rails.logger.debug
,但是没有输出到development.log文件中。有什么想法吗?
更新
我还应该说明一下,我是从控制器中调用此函数,其他信息例如SQL查询已经被输出到日志文件中。
源代码
https://github.com/kyledecot/skateparks-web
Gemfile
source 'http://rubygems.org/'
gem 'rails', '3.0.7'
gem 'rake', '~> 0.8.7'
gem 'devise'
gem 'omniauth'
gem 'flash_cookie_session'
gem 'carrierwave'
gem 'mini_magick'
gem 'barometer'
gem 'gdata_19', :require => 'gdata'
gem 'google_places'
gem 'fleakr'
gem 'resque'
gem 'nokogiri'
gem 'decent_exposure'
gem 'cancan'
gem 'friendly_id'
gem 'breadcrumbs_on_rails'
gem 'defensio'
gem 'twitter'
gem 'thinking-sphinx', :require => 'thinking_sphinx'
gem 'ts-resque-delta', '1.0.0', :require => 'thinking_sphinx/deltas/resque_delta'
gem 'mime-types', :require => 'mime/types'
gem 'vpim'
gem 'will_paginate', '~> 3.0.pre2'
gem 'acts_as_geocodable'
gem 'acts_as_audited', '2.0.0.rc7'
gem 'passenger'
gem 'paper_trail'
gem 'thin'
gem 'compass', '>= 0.11.1'
gem 'guard-compass'
gem 'redcarpet'
gem 'mysql2', '0.2.7'
gem 'placemaker'
group :development, :test do
gem 'sqlite3'
gem 'capybara'
gem 'launchy'
gem "rspec-rails"
gem 'rb-fsevent', :require => false if RUBY_PLATFORM =~ /darwin/i
gem 'guard-rspec'
gem 'guard-bundler'
gem 'guard-delayed'
gem 'factory_girl'
gem 'rspec'
end
group :production do
end
enviornment.rb
require File.expand_path('../application', __FILE__)
Skateparks::Application.initialize!
ActiveRecord::Base.logger.level = Logger::INFO
ImagesController
def server
logger.warn "WARN!" # nothing
logger.info "INFO!" # nothing
logger.debug "DEBUG!" # nothing
puts Rails.logger.inspect # shows
puts "PUTS!" # shows
end
使用rails s
的日志输出
#<ActiveSupport::BufferedLogger:0x000001058867a0 @level=0, @buffer={}, @auto_flushing=1, @guard=#<Mutex:0x000001058866b0>, @log=#<File:/Users/Kyle/Desktop/skateparks-web/log/development.log>>
PUTS!
Started GET "/images/fd3b38315c30532b3a55bb84d35e5925/34_m.png" for 127.0.0.1 at 2011-06-29 03:41:50 -0400
User Load (0.3ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 1 LIMIT 1