syslogger: Incompatible with Rails 4.2 active jobs?

Here’s my configuration in production.rb:

require 'syslogger'
config.logger = Syslogger.new("fortress-stats", Syslog::LOG_PID, Syslog::LOG_LOCAL7)

When I try to create an async job to run (e.g. MyJob.perform_later('foo', d1, d2)) I get the following error:

NoMethodError: undefined method `current_tags' for #<Proc:0x00000005b6a580>
    from /var/deploy/fortress_stats/web_head/shared/bundle/ruby/2.2.0/gems/activejob-4.2.0/lib/active_job/logging.rb:50:in `logger_tagged_by_active_job?'
    from /var/deploy/fortress_stats/web_head/shared/bundle/ruby/2.2.0/gems/activejob-4.2.0/lib/active_job/logging.rb:42:in `tag_logger'
    from /var/deploy/fortress_stats/web_head/shared/bundle/ruby/2.2.0/gems/activejob-4.2.0/lib/active_job/logging.rb:13:in `block (2 levels) in <module:Logging>'
    from /var/deploy/fortress_stats/web_head/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:436:in `instance_exec'
    from /var/deploy/fortress_stats/web_head/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:436:in `block in make_lambda'
    from /var/deploy/fortress_stats/web_head/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:337:in `call'
    from /var/deploy/fortress_stats/web_head/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:337:in `block in simple'
    from /var/deploy/fortress_stats/web_head/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:92:in `call'
    from /var/deploy/fortress_stats/web_head/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:92:in `_run_callbacks'
    from /var/deploy/fortress_stats/web_head/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:734:in `_run_enqueue_callbacks'
    from /var/deploy/fortress_stats/web_head/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:81:in `run_callbacks'
    from /var/deploy/fortress_stats/web_head/shared/bundle/ruby/2.2.0/gems/activejob-4.2.0/lib/active_job/enqueuing.rb:67:in `enqueue'
    from /var/deploy/fortress_stats/web_head/shared/bundle/ruby/2.2.0/gems/activejob-4.2.0/lib/active_job/enqueuing.rb:17:in `perform_later'
    from (irb):21
    from /var/deploy/fortress_stats/web_head/shared/bundle/ruby/2.2.0/gems/railties-4.2.0/lib/rails/commands/console.rb:110:in `start'
    from /var/deploy/fortress_stats/web_head/shared/bundle/ruby/2.2.0/gems/railties-4.2.0/lib/rails/commands/console.rb:9:in `start'
    from /var/deploy/fortress_stats/web_head/shared/bundle/ruby/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:68:in `console'
    from /var/deploy/fortress_stats/web_head/shared/bundle/ruby/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
    from /var/deploy/fortress_stats/web_head/shared/bundle/ruby/2.2.0/gems/railties-4.2.0/lib/rails/commands.rb:17:in `<top (required)>'
    from bin/rails:8:in `require'
    from bin/rails:8:in `<main>'irb(main):022:0> exit

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 19 (2 by maintainers)

Commits related to this issue

Most upvoted comments

It appears I was doing it wrong. When I correct the code to the following it works:

require 'syslogger'
config.logger = ActiveSupport::TaggedLogging.new(Syslogger.new("fortress-stats", Syslog::LOG_PID, Syslog::LOG_LOCAL7))