当前位置: 首页 > 工具软件 > Log4r > 使用案例 >

rails启动, log4r 报log文件不能写的错误

石正奇
2023-12-01

一错误信息:

$ ruby script/console production
Loading production environment (Rails 2.3.15)
/usr/local/rvm/gems/ruby-1.8.7-p374@rails2317/gems/log4r-1.1.10/lib/log4r/yamlconfigurator.rb:68:in `each': Problem creating outputter: 'log/batch/teacher_syn_eleutian/teacher_syn_20131110.log' is not writable! (Log4r::ConfigError)
        from /usr/local/rvm/gems/ruby-1.8.7-p374@rails2317/gems/log4r-1.1.10/lib/log4r/yamlconfigurator.rb:68:in `decode_yaml'
        from /home/togo-dev/rails/config/initializers/log4r.rb:43
        from /usr/local/rvm/gems/ruby-1.8.7-p374@rails2317/gems/activesupport-2.3.15/lib/active_support/dependencies.rb:173:in `load_without_new_constant_marking'
        from /usr/local/rvm/gems/ruby-1.8.7-p374@rails2317/gems/activesupport-2.3.15/lib/active_support/dependencies.rb:173:in `load'
        from /usr/local/rvm/gems/ruby-1.8.7-p374@rails2317/gems/rails-2.3.15/lib/initializer.rb:622:in `load_application_initializers'
        from /usr/local/rvm/gems/ruby-1.8.7-p374@rails2317/gems/rails-2.3.15/lib/initializer.rb:621:in `each'
        from /usr/local/rvm/gems/ruby-1.8.7-p374@rails2317/gems/rails-2.3.15/lib/initializer.rb:621:in `load_application_initializers'
        from /usr/local/rvm/gems/ruby-1.8.7-p374@rails2317/gems/rails-2.3.15/lib/initializer.rb:176:in `process'
        from /usr/local/rvm/gems/ruby-1.8.7-p374@rails2317/gems/rails-2.3.15/lib/initializer.rb:113:in `send'
        from /usr/local/rvm/gems/ruby-1.8.7-p374@rails2317/gems/rails-2.3.15/lib/initializer.rb:113:in `run'
        from /home/togo-dev/rails/config/environment.rb:27
        from /usr/local/rvm/rubies/ruby-1.8.7-p374/lib/ruby/1.8/irb/init.rb:254:in `require'
        from /usr/local/rvm/rubies/ruby-1.8.7-p374/lib/ruby/1.8/irb/init.rb:254:in `load_modules'
        from /usr/local/rvm/rubies/ruby-1.8.7-p374/lib/ruby/1.8/irb/init.rb:252:in `each'
        from /usr/local/rvm/rubies/ruby-1.8.7-p374/lib/ruby/1.8/irb/init.rb:252:in `load_modules'
        from /usr/local/rvm/rubies/ruby-1.8.7-p374/lib/ruby/1.8/irb/init.rb:21:in `setup'

启动的用户是dev

二原因:

 在使用dev启动之前, 我用root用户进行了 ruby script/console production 的操作。


解决办法:

  删掉/log/batch 这个文件夹。 就可以了


完毕

 类似资料: