Skip to content
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

Configure Que while in rake task #95

Closed
alex88 opened this issue Mar 12, 2015 · 10 comments
Closed

Configure Que while in rake task #95

alex88 opened this issue Mar 12, 2015 · 10 comments

Comments

@alex88
Copy link

alex88 commented Mar 12, 2015

I'm trying to configure logging, while in a rails process it uses Rails.logger for logs, in the rake task it uses STDOUT. Is there a convention in where to configure Que while running in the rake task?

So I don't have to put everything in the workers

@chanks
Copy link
Collaborator

chanks commented Mar 12, 2015

Hmm, yeah, it probably makes more sense to use the configured logger (which defaults to Rails.logger) in the rake task. I'll make that change, unless anyone has any objections?

@alex88
Copy link
Author

alex88 commented Mar 12, 2015

Since Que doesn't load rails initializers, could makes sense to add a way to include a configuration script for the rake task?

@chanks
Copy link
Collaborator

chanks commented Mar 12, 2015

The rake task has the :environment task as a dependency, so it should be running the initializers. It just manually sets the logging to go to STDOUT afterward. Are you sure it isn't running the initializers?

@alex88
Copy link
Author

alex88 commented Mar 12, 2015

Ops you're right, it was foreman blocking stdout output. Anyway yes, the only thing I would need is to be able to configure the logger while in rake task

@chanks
Copy link
Collaborator

chanks commented Mar 12, 2015

Would it work for you to use the Rails logger, or whatever Que is configured to use for logging in general? I don't want to have separate configuration options for working jobs in the server process and in a rake task unless it's really necessary.

@alex88
Copy link
Author

alex88 commented Mar 12, 2015

For now yes, since I just want to be able to use loggly within the rake task 😉

@chanks
Copy link
Collaborator

chanks commented Mar 12, 2015

Alright, would you try the rake-task-logger branch and see if it works for you? I'm not set up to test it right now. I'll merge it into master before the next release if nobody complains about wanting the old behavior.

@alex88
Copy link
Author

alex88 commented Mar 17, 2015

@chanks sorry for the delay, the branch works fine!

@chanks
Copy link
Collaborator

chanks commented Mar 17, 2015

No problem, good to hear!

@chanks
Copy link
Collaborator

chanks commented Mar 18, 2015

Merged and released in 0.10.0.

@chanks chanks closed this as completed Mar 18, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants