#18243: Management shell should make it easy to force LOGGING_CONFIG=None
-------------------------------------+-------------------------------------
Reporter: ncoghlan@… | Owner: nobody
Type: Uncategorized | Status: new
Component: Core (Management | Version: 1.3
commands) | Resolution:
Severity: Normal | Triage Stage:
Keywords: | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by ncoghlan@…):
No, I don't think it needs to be opt-in as such, I'd just like to see the
*location* of the implicit configuration changed so it doesn't happen as a
side effect of importing django.conf.
For example, on the web side, ensuring that logging is configured could be
handled by django.core.handlers.wsgi.WSGIHandler()
On the management CLI side, it could be handled by
django.core.management.execute_from_command_line() (and done in such a way
that the "--help" code path *avoids* initialising logging)
Those are the active entry points I use, but there may be others.
There are a couple of advantages to doing things this way:
1. It means that a broken logging configuration isn't quite as fatal an
error. At the moment, logging config problems mean that *importing Django*
fails. By moving the initialisation, the failure instead moves to code
paths that are actually likely to *want* the logging enabled, while paths
that don't care about logging (like the --help output) won't be affected.
2. It's easier to control. Instead of having to set global state to affect
whether or not the logging gets configured, you can start adding control
parameters to the active interfaces (such as an "init_logging" callable
parameter for WSGIHandler and execute_from_command_line that can be set to
None to disable logging, left at the default to use the logging config
from settings.py, or customised to use something else entirely)
--
Ticket URL: <https://code.djangoproject.com/ticket/18243#comment:6>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.