On Thu, Jan 8, 2009 at 11:49 PM, Herb <[email protected]> wrote: > > I am having trouble with the logging facility. > My TG application imports several modules, each of which enables > logging. Counting the main controllers.py there are six modules that > enable logging. The problem is that after all of them are imported, > each log event is replicated 6 times in the log. I would like each > event to appear only once, of course. > > I do this in the controllers module and the other one I am working on: > > import logging > log = logging.getLogger("mypackage.controllers") > > In other modules, this is used: > > import logging > logging.basicConfig(level=logging.info, > format = %(asctime)s\t%(levelname)s\t%message)s', > filename = "mylogfile.log", > filemode ='w') > > What am I doing wrong. How do I get it to either output unique files > for each module or to output only one entry for each logging event? >
you are setting the logging 6 times. you should use the first snip in all usages for logging purposes, the "basicConfig" call you are making should be deleted and you should let Turbogears (actually paste) do this for you. take a look at the last part of your config file.Did you took a look at this page http://docs.turbogears.org/1.0/LoggingSystem ? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/turbogears?hl=en -~----------~----~----~----~------~----~------~--~---

