Thanks, Jorge.
I did that. I set them all to the same:
import logging
log = logging.getLogger("mypackage.controllers")
It made no difference. And yes, I had read
http://docs.turbogears.org/1.0/LoggingSystem.
It still repeats every log entry six times.
Here is another way of asking a similar question:
How do I instantiate logging in a module that may be called as part of
any number of different packages? I this case, I can change the
various modules, but if I were to reuse one of these modules in
another package, it would be set to the wrong name, unless
"mypackage.controllers" should be taken literally rather than
inserting the name of my package in place of "mypackage."
Thanks,
Herb
On Jan 10, 1:30 pm, "Jorge Vargas" <[email protected]> wrote:
> 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 pagehttp://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
-~----------~----~----~----~------~----~------~--~---