Sionide21
Sionide21

Reputation: 2211

Django logging initialization within a cron script

I have my logging configured in settings.py but I want to use it in a cron script. Since I haven't loaded any django stuff yet when the script starts, the logger doesn't work. I can get logging by starting my script with

from django.conf import settings
settings.DEBUG

but is there a better way to make sure the logging has been initialized?

Upvotes: 0

Views: 412

Answers (1)

S.Lott
S.Lott

Reputation: 391992

is there a better way to make sure the logging has been initialized?

Yes. Write custom Django commands.

http://docs.djangoproject.com/en/1.3/howto/custom-management-commands

Upvotes: 1

Related Questions