Skip to content
This repository has been archived by the owner on Feb 27, 2021. It is now read-only.

Logging options do nothing if the root logger already has any handlers #2

Open
slinkp opened this issue Oct 12, 2011 · 1 comment
Open

Comments

@slinkp
Copy link

slinkp commented Oct 12, 2011

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?

@lilspikey
Copy link
Owner

Sounds like a plan.

I should probably review the logging, as I wrote most of it pre-1.3.

Hopefully I'll get a chance at the weekend to do this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants