-
Notifications
You must be signed in to change notification settings - Fork 113
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
Cron fails to log, while calling the function in django's shell works #31
Comments
Shouldn't be there a logger for |
Can you provide your Django & Python version with your (simplified) settings for CRONJOBS, LOGGING? Additionally what happens when you run
and find the logging job's hashed id and run
Does the logging work in this case? |
Django: 1.9.4, Py: 2.7.11 In settings.py:
When runnig and running |
Maybe we're running into a problem because the current working dir differs when started via cron. Please change the FileHandler's filename to be absolute. Does this help? Another try: switch to ConsoleHandler and pipe result into a file:
Does this work? |
I came into the same problem. After changing the FileHandler's filename to be absolute path, it all settled. Probably the working dir issue. Thanks. |
Thanks for sharing @Ryan-ZJU. I added a faq entry about this. Hopefully this helps the next one :) |
I have a tasks.py file that's located in project/app/tasks.py that uses the standard logger:
The logging file is configured with loggers for all of the following:
django
,app
,django_crontab
,django_crontab.crontab
,crontab
, and''
When is open the shell and run the function, the logging appears:
Yet, when I add the cron job using
python manage.py crontab add
everything works (I can see the end result appear), yet nothing gets logged. Any reason why logging should work using the shell, but not as a cron?The text was updated successfully, but these errors were encountered: