-
Notifications
You must be signed in to change notification settings - Fork 188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No log when run on que CLI #310
Comments
See the logging section of the docs. We use a logging middleware: # frozen_string_literal: true
module DexProviderBridge
module Que
module JobMiddleware
class Logging
def initialize(logger:)
@logger = logger
end
def call(job)
job_args = args(job)
logger.info("Starting #{job.job_name} job", **job_args)
before = Time.now.getutc
yield
duration = '%.2f' % (Time.now.getutc - before)
logger.info("Finished #{job.job_name} job in #{duration}s", **job_args)
end
private
def args(job)
job.que_attrs[:args].reduce({}, :merge)
end
attr_reader :logger
end
end
end
end middlewares = [
DexProviderBridge::Que::JobMiddleware::Logging.new(logger: app['logger']),
# ...
]
middlewares.each do |middleware|
Que.job_middleware.push(middleware)
end |
Closing this now @drselump14, feel free to re-open if still an issue. |
For anyone who's blocked waiting for a fix for this to upgrade Rails, here is a terrible hack that makes the error disappear. BEWARE: This may do terrible things; it's just a monkey patch that applies the fix in #423, and I have no idea whether it's a good idea. In
|
I can't find any log when running the worker with que CLI
Adding a job works fine, and workers picked up the job but no information on the log.
Did I miss something?
This is my job
The Que::Job format didn't work either.
The text was updated successfully, but these errors were encountered: