#18243: Management shell should make it easy to force LOGGING_CONFIG=None
-------------------------------+--------------------
     Reporter:  ncoghlan@…     |      Owner:  nobody
         Type:  Uncategorized  |     Status:  new
    Component:  Uncategorized  |    Version:  1.3
     Severity:  Normal         |   Keywords:
 Triage Stage:  Unreviewed     |  Has patch:  0
Easy pickings:  0              |      UI/UX:  0
-------------------------------+--------------------
 The standard behaviour of django means that the management interface is
 largely useless when run on a server where only the web server user has
 write access to the log files:
 http://stackoverflow.com/questions/3980889/django-prevent-logging-
 permission-errors-from-shell/

 The recommended solution is currently to:
 1. Create a separate management_settings.py file that is merely:
 {{{
    from .settings import *
    LOGGING_CONFIG = None
 }}}
 2. Set up the management command to use management_settings.py instead of
 the same settings file as the web service (or pass --settings explicitly
 on the command line)

 While that's powerful and effective, an explicit "--nolog" option would be
 a lot simpler. Also, "--help" should imply "--nolog" to prevent behaviour
 like the following:

 {{{
 $ python -m pulpdist.manage_site --help
 Usage: manage_site.py subcommand [options] [args]

 Options:
   -v VERBOSITY, --verbosity=VERBOSITY
                         Verbosity level; 0=minimal output, 1=normal
 output,
                         2=all output
   --settings=SETTINGS   The Python path to a settings module, e.g.
                         "myproject.settings.main". If this isn't provided,
 the
                         DJANGO_SETTINGS_MODULE environment variable will
 be
                         used.
   --pythonpath=PYTHONPATH
                         A directory to add to the Python path, e.g.
                         "/home/djangoprojects/myproject".
   --traceback           Print traceback on exception
   --version             show program's version number and exit
   -h, --help            show this help message and exit
 Traceback (most recent call last):
   File "/usr/lib64/python2.6/runpy.py", line 122, in _run_module_as_main
     "__main__", fname, loader, pkg_name)
   File "/usr/lib64/python2.6/runpy.py", line 34, in _run_code
     exec code in run_globals
   File "/usr/lib/python2.6/site-packages/pulpdist/manage_site.py", line
 32, in <module>
     execute_from_command_line(sys.argv)
   File "/usr/lib/python2.6/site-
 packages/django/core/management/__init__.py", line 429, in
 execute_from_command_line
     utility.execute()
   File "/usr/lib/python2.6/site-
 packages/django/core/management/__init__.py", line 377, in execute
     sys.stderr.write(self.main_help_text() + '\n')
   File "/usr/lib/python2.6/site-
 packages/django/core/management/__init__.py", line 239, in main_help_text
     commands = get_commands().keys()
   File "/usr/lib/python2.6/site-
 packages/django/core/management/__init__.py", line 101, in get_commands
     apps = settings.INSTALLED_APPS
   File "/usr/lib/python2.6/site-packages/django/utils/functional.py", line
 276, in __getattr__
     self._setup()
   File "/usr/lib/python2.6/site-packages/django/conf/__init__.py", line
 42, in _setup
     self._wrapped = Settings(settings_module)
   File "/usr/lib/python2.6/site-packages/django/conf/__init__.py", line
 139, in __init__
     logging_config_func(self.LOGGING)
   File "/usr/lib/python2.6/site-packages/django/utils/dictconfig.py", line
 553, in dictConfig
     dictConfigClass(config).configure()
   File "/usr/lib/python2.6/site-packages/django/utils/dictconfig.py", line
 352, in configure
     '%r: %s' % (name, e))
 ValueError: Unable to configure handler 'debug_log': [Errno 13] Permission
 denied: '/var/log/pulpdist/debug.log'
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/18243>
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.

Reply via email to