On 1/25/07, Benedict Verheyen <[EMAIL PROTECTED]> wrote: ... > For instance, here are my settings for logging: ... > logger = logging.getLogger('stats') ... > Or i should be doing this in the settings file and importing this in my > files. But then again, i use utility classes and then those would have > to import settings to be able to use the same logfile. That doesn't feel > right.
After you've done this setup code in settings.py, this is all you need in the other files: import logging logger = logging.getLogger('stats') logger.error('hi there') ==== The logging module keeps a registry of loggers and associated handlers; calling getLogger gets a reference to logger you already configured with the handlers in settings.py. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---