On Oct 1, 10:28 pm, Kevin Howerton <kevin.hower...@gmail.com> wrote:
> # Ensure the creation of the Django logger > logger = logging.getLogger('django') > I think the comment is misleading. I agree, there'd be no need to create the logger there as it doesn't seem to be used there. Two points: 1. Library code should add a NullHandler instance to the top-level logger so that in the absence of any other configuration, you don't get spurious "No handlers found ..." message. This should be just after the logger = logging.getLogger('django') line: logger.addHandler(NullHandler()) This line should always be there, and the NullHandler should be omitted from the example configurations. Essentially, it's implicitly there in addition to the handlers configured in settings.py. If this is not done and the user turns off configuration via LOGGING_CONFIG = None but omits to add any other configuration, you would get that "No handlers found ..." message. 2. Library code should generally never add handlers (other than NullHandler) unless it's under the application (site) developer's control. That's happening in this case because of the convention with LOGGING_CONFIG: the site developer is effectively telling Django to add those handlers, albeit in a declarative way. Hope that's clear! Regards, Vinay Sajip -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-develop...@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.