How to rotate, override, or turn off logging from Sunspot Solr Rubygem?

前端 未结 5 692
予麋鹿
予麋鹿 2021-02-06 10:48

I\'ve had great experiences with Sunspot Solr search for Ruby on Rails, however, its log files are growing incredibly large and I can\'t seem to find a way to either rot

5条回答
  •  被撕碎了的回忆
    2021-02-06 11:26

    Currently the log_level is not handled correctly. The fix is on Github, which is a 2.x release.

    You can wait for the next gem release. And if you don't and is not afraid of risk, you can use the following in the Gemfile:

    # use selectively
    gem 'sunspot_rails', :git => "git://github.com/sunspot/sunspot.git", :require =>  "sunspot_rails"
    gem 'sunspot_solr', :git => "git://github.com/sunspot/sunspot.git", :require => "sunspot_solr"
    

    I use Linux logrotate:

    /home/path/log/*.log {
      su username pwd
      daily
      missingok
      rotate 7
      delaycompress
      notifempty
      copytruncate
    }
    

提交回复
热议问题