mattyr / sidecloq

Recurring / Periodic / Scheduled / Cron job extension for Sidekiq
MIT License
88 stars 12 forks source link

Logs as an array? #22

Closed krainboltgreene closed 5 years ago

krainboltgreene commented 5 years ago

My sidekiq configuration:

Sidekiq.configure_server do |config|
  config.redis = Iron::REDIS_SIDEKIQ_SERVER_CONNECTION_POOL
  config.logger = Rails.logger
  config.client_middleware do |chain|
    chain.add(SidekiqClientPaperTrailMiddleware)
    chain.add(SidekiqClientLogTaggingMiddleware)
    chain.add(SidekiqClientKillswitchMiddleware)
  end
  config.server_middleware do |chain|
    chain.add(SidekiqServerLogTaggingMiddleware)
    chain.add(SidekiqServerExceptionHandlerMiddleware)
    chain.add(SidekiqServerPaperTrailMiddleware)
  end
end

Sidekiq.configure_client do |config|
  config.redis = Iron::REDIS_SIDEKIQ_CLIENT_CONNECTION_POOL
  config.logger = Rails.logger
  config.client_middleware do |chain|
    chain.add(SidekiqClientPaperTrailMiddleware)
    chain.add(SidekiqClientKillswitchMiddleware)
    chain.add(SidekiqClientLogTaggingMiddleware)
  end
end

The output:

["Runner starting"]
["Starting locker check task"]
["Leader lock not held"]
["Leader lock not held"]
["Leader lock not held"]
["Leader lock not held"]
["Leader lock held"]
["Obtained leader lock"]
["Loading schedules into redis"]
["Starting scheduler"]
["Scheduling jobs"]
["Leader lock held"]
["Leader lock held"]
["Leader lock held"]
["Leader lock held"]
["Leader lock held"]
["Leader lock held"]
["Leader lock held"]
["Leader lock held"]
["Leader lock held"]
["Leader lock held"]
["Leader lock held"]
["Leader lock held"]
["Leader lock held"]
["Leader lock held"]
["Leader lock held"]
["Leader lock held"]
["Leader lock held"]
["Leader lock held"]
["Leader lock held"]
["Leader lock held"]
["Leader lock held"]
["Leader lock held"]
["Leader lock held"]
["Leader lock held"]
["Leader lock held"]
["Leader lock held"]
["Leader lock held"]
["Leader lock held"]
["Leader lock held"]
["Leader lock held"]
["Leader lock held"]
["Leader lock held"]
mattyr commented 5 years ago

Wow, can't believe I overlooked this for so long. Thanks for pointing it out! Changed the behavior to not log as an array. Will push a new release shortly.

krainboltgreene commented 5 years ago

Thanks so much! I think this was hidden for so long because sidekiq doesn't normally log to STDOUT. Easy to miss stuff in development.log.