lilspikey/django-background-task — Issue #2: Logging options do nothing if the root logger already has any handlers
Author: slinkp
Created: 2011-10-12 18:21:53+00:00
State: open

You do your logging setup via logging.basicConfig(). As per the python docs:
"This function does nothing if the root logger already has handlers configured for it."

So if I have logging configured for django via settings.LOGGING, I can't use the process_tasks logging options to override that.
And confusingly, --log-file silently has no effect.

This is really problematic when running under cron if settings.LOGGING includes a stream handler, as you need to silence everything but errors on stdout/stderr to avoid having cron email you non-error output all the time.

Since process_tasks runs in its own process, maybe we should instead remove all handlers and add a file handler if and only if --log-file is provided?