Vote #71911
完了Fetching Email from IMAP/POP3 - uninitialized constant RAILS_DEFAULT_LOGGER error
0%
説明
Hi Everyone,
I have just updated to Redmine 2.0 and it seams that I can't fetch incoming emails anymore.
For fetching them I use a cron job like:
rake -f /path/to/redmine/Rakefile redmine:email:receive_imap RAILS_ENV="production" host=imap.gmail.com port=993 ssl=1 username=redmine@domain.com password=************
When there's no email to fetch the above command is not throwing any error but when an email is received it throws:
rake aborted!
uninitialized constant RAILS_DEFAULT_LOGGER
Database: MySQL 5.1.61
Ruby version 1.8.7 (x86_64-linux)
RubyGems version 1.8.17
Rack version 1.4
Rails version 3.2.3
Redmine version 2.0
Error stack trace:
** Invoke redmine:email:receive_imap (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute redmine:email:receive_imap
rake aborted!
uninitialized constant RAILS_DEFAULT_LOGGER
/var/www/redmine/lib/redmine/imap.rb:56:in logger'check'
/var/www/redmine/lib/redmine/imap.rb:34:in
/var/www/redmine/lib/redmine/imap.rb:32:in each'check'
/var/www/redmine/lib/redmine/imap.rb:32:in
/var/www/redmine/lib/tasks/email.rake:133
/usr/lib64/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:205:in call'execute'
/usr/lib64/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:205:in
/usr/lib64/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:200:in each'execute'
/usr/lib64/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:200:in
/usr/lib64/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:158:in invoke_with_call_chain'synchronize'
/usr/lib/ruby/1.8/monitor.rb:242:in
/usr/lib64/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:151:in invoke_with_call_chain'invoke'
/usr/lib64/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:144:in
/usr/lib64/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:116:in invoke_task'top_level'
/usr/lib64/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in
/usr/lib64/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in each'top_level'
/usr/lib64/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in
/usr/lib64/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in standard_exception_handling'top_level'
/usr/lib64/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:88:in
/usr/lib64/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:66:in run'standard_exception_handling'
/usr/lib64/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in
/usr/lib64/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:63:in run'load'
/usr/lib64/ruby/gems/1.8/gems/rake-0.9.2.2/bin/rake:33
/usr/bin/rake:19:in
/usr/bin/rake:19
journals
Indeed, deprecated constant "has been removed 2 years ago":https://github.com/rails/rails/commit/800695ad4cef33347bcfef6df7634ff533582449.
--------------------------------------------------------------------------------
I have been able to fix it by changing the lib/redmine/imap.rb file's lines:
def logger
RAILS_DEFAULT_LOGGER
end
in
def logger
Logger.new(STDERR)
end
I'm not a Ruby developer, so I really don't know if this is the best way of do it. I just had to find a quick path in order to activate this feature, since redmine is running on my company's development server.
--------------------------------------------------------------------------------
I think it should be replaced by @::Rails.logger@.
--------------------------------------------------------------------------------
You are right.
Thank you very much for your help.
The same issue is valid for pop3.rb.
--------------------------------------------------------------------------------
Fix committed in r9712, thanks.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Merged.
--------------------------------------------------------------------------------