﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
17680	logging from command line	Brian May <brian@…>	vanessagomes	"The documentation says ""Logging is configured immediately after settings have been loaded. Since the loading of settings is one of the first things that Django does, you can be certain that loggers are always ready for use in your project code.""

I assume this to be correct for web requests. It also seems to be correct for the ""manage.py shell"" interactive shell. It does not seem to work for command line applications however. For example, if I try to run the following code:

{{{
#!/usr/bin/env python
from django.core.management import setup_environ
from kgadmin.conf import settings
setup_environ(settings)

import logging
logger = logging.getLogger(__name__)
logger.debug(u""something weent debug"")
logger.info(u""something weent info"")
logger.error(u""something weent error"")
}}}

then logging is not initialized and I get the following message:

{{{
No handlers could be found for logger ""__main__""
}}}

To fix this, I have to insert code like the following to force the settings to become initialized:

{{{
import django.conf
django.conf.settings.LOGGING
}}}

I would have hoped that setup_environ(...) would do all of this, but apparently not.

This is with python-django 1.3-2ubuntu1.1 running on Ubuntu 11.10

Brian May"	Bug	closed	Documentation	1.3	Normal	fixed		vanessagomes	Accepted	1	0	0	1	0	0
