Getting Sidekiq to work with papertrail

I am trying to transfer all the records of my rail (3.2.17) to the application and setting to papertrail. Now I am trying to set the registrar for sidekiq in the config/initializers/sidekiq.rbfollowing way:

Sidekiq.configure_server do |config|
  Sidekiq::Logging.logger = RemoteSyslogLogger.new('logs.papertrailapp.com', ENV.fetch('PAPERTRAIL_PORT'), program: "sidekiq-#{Rails.env}")
end

When I try to run sidekiq with:

bundle exec sidekiq --index 0 --pidfile <PATH_TO_PID> --environment staging --daemon

I get

You really should set a logfile if you're going to daemonize
...bundle/ruby/2.0.0/gems/sidekiq-2.17.4/lib/sidekiq/cli.rb:141:in `daemonize'
...bundle/ruby/2.0.0/gems/sidekiq-2.17.4/lib/sidekiq/cli.rb:39:in `parse'
...bundle/ruby/2.0.0/gems/sidekiq-2.17.4/bin/sidekiq:7:in `<top (required)>'
...bundle/ruby/2.0.0/bin/sidekiq:23:in `load'
...bundle/ruby/2.0.0/bin/sidekiq:23:in `<main>'

However, if I give sidekiq a dummy file for writing in the first place:

bundle exec sidekiq --index 0 --pidfile <PATH_TO_PID> --environment staging --daemon --logfile /dev/null

it works like a charm (logs are sent to papertrail) since the initializer seems to undo the previous option.

But I find this approach pretty ugly. Has anyone got a cleaner approach to this?

+4
source share
1 answer

sidekiq, : . , , , .

, , , sidekiq:

bundle exec sidekiq | logger -t sidekiq
0

Source: https://habr.com/ru/post/1535895/


All Articles