This is the sort of thing that can be done at the top level of the module, so it is executed once per process, rather than once per request.
--Ned. [EMAIL PROTECTED] wrote: > I've been adding additional logging to my django application by > dropping in calls in the views.py. However, I'm concerned that I've > really overdoing it with setting up a new logging instance on each > call. > > Right now, I've have the following code in each view that wants to log: > > ll=logging.getLogger("MyLog") > hand = logging.FileHandler("my_app_log") > format = logging.Formatter("%(levelname)-10s %(name)-12s > %(asctime)s %(message)s") > hand.setFormatter(format) > ll.addHandler(hand) > ll.warn("some message here....") > > Where is the "right place" to establish a logger and set up it's > formatting in a django application? How I'm doing it now works, but > really feels wrong. > > -joe > > > > > > > -- Ned Batchelder, http://nedbatchelder.com --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---