yaml 経由で構成された log4r 1.1.10 を使用する Rails 4.1 アプリがあり、すべて正常に動作します。ここで、カスタム レベルを追加したいと思います。したがって、yaml ファイルの先頭に、次の 7 行を追加しましたlog4r_config
。
log4r_config:
pre_config:
custom_levels:
- INFO
- WARN
- ERROR
- SERIOUS
- FATAL
# define all loggers ...
loggers:
私のapplication.rbの関連部分は次のようになります。
require 'log4r'
require 'log4r/yamlconfigurator'
require File.join(File.dirname(__FILE__),"../lib/rollable_file_outputter.rb")
include Log4r
log4r_config = YAML.load_file(File.join(File.dirname(__FILE__),"log4r.yml"))
YamlConfigurator.decode_yaml( log4r_config['log4r_config'] )
しかし、今アプリを起動すると、
ArgumentError: Log level must be in 0..7
/opt/thermyos.com/server/shared/bundle/ruby/2.0.0/gems/log4r-1.1.10/lib/log4r/yamlconfigurator.rb:189:in `decode_logger_common'
/opt/thermyos.com/server/shared/bundle/ruby/2.0.0/gems/log4r-1.1.10/lib/log4r/yamlconfigurator.rb:175:in `decode_logger'
/opt/thermyos.com/server/shared/bundle/ruby/2.0.0/gems/log4r-1.1.10/lib/log4r/yamlconfigurator.rb:69:in `block in decode_yaml'
/opt/thermyos.com/server/shared/bundle/ruby/2.0.0/gems/log4r-1.1.10/lib/log4r/yamlconfigurator.rb:69:in `each'
/opt/thermyos.com/server/shared/bundle/ruby/2.0.0/gems/log4r-1.1.10/lib/log4r/yamlconfigurator.rb:69:in `decode_yaml'
/opt/thermyos.com/server/releases/20141209152838/config/application.rb:23:in `<top (required)>'
yamlでカスタムlog4rレベルを定義する正しい方法は何ですか?