On Jan 28, 11:07 am, Rama Vadakattu <ramaakrish...@gmail.com> wrote:
> Thanks bruno desthuilliers
> the tip which you have given is working.
>

I think it's better just to have the logging configuration done at the
bottom of settings.py (either programmatically or via fileConfig).
Typically, if you have code in your apps which adds logging handlers,
and if your code gets imported more than once, you have to be careful
not to add handlers multiple times (otherwise your log messages get
emitted multiple times). Then, in your app modules, you only have to
use loggers:

import logging

logger = logging.getLogger(__name__) # name of module

...

logger.debug("A debug message")

...

Typically, you change logging configuration on a site-wide basis (e.g.
turning verbosity up and down for different apps in the site) so
settings.py is a reasonable place to keep this. Then individual apps
never need be concerned about where their logging output is going (in
fact they shouldn't hardcode this type of information, especially if
they are meant to be reusable).

Regards,

Vinay Sajip

--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to