在 Ruby 中使用log4r
时,我编写了一个类似于以下内容的配置文件:
require 'rubygems'
require 'log4r'
require 'log4r/outputter/datefileoutputter'
SERVICE_LOG = {
:log_name => 'service',
:log_file => 'service.log',
:log_level => Log4r::DEBUG,
:message_pattern => "[%-5l %d] %C: %M",
:date_pattern => "%Y-%m-%d %H:%M:%S"
}
当我运行它时,它抛出了以下异常:
C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:440:in `load_missing_constant': uninitialized constant Log4r::DEBUG (NameError)
为什么这样做?