On Dec 9, 9:54 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
> Ben Sizer schrieb:
>
> > I'm sure this is simple once you understand it, but it's actually
> > quite confusing to try and read through all these things and try to
> > work out what it's actually referring to. The documentation (not just
> > TG, Python's too) is very vague.
>
> I think the second paragraph in the logging-module docs is pretty clear:
>
> """
> Logging is performed by calling methods on instances of the Logger class
> (hereafter called loggers). Each instance has a name, and they are
> conceptually arranged in a name space hierarchy using dots (periods) as
> separators. For example, a logger named "scan" is the parent of loggers
> "scan.text", "scan.html" and "scan.pdf". Logger names can be anything
> you want, and indicate the area of an application in which a logged
> message originates.
>
> """
>
> http://docs.python.org/lib/module-logging.html

I consider those docs to be among the worst in the entire Python
library. Firstly, there's no point it talking about a hierarchy if it
doesn't then go on to explain what that hierarchy means. Yes, there's
a source code dump on the next page, but that doesn't excuse leaving
out a little explanation from the front page summary. Secondly, the
example given is just plain misleading - since when did 3 different
file types imply different areas of an application? In a logging
context it's more likely to imply different methods of output. But
that's actually the job of the handlers, not the loggers.

It's almost funny that the PEP seems to be far better documentation
than the actual module docs! (http://www.python.org/dev/peps/
pep-0282/)

> The config-file-format of the logging-module is somewhat awkward though
> - the explicit declaring of loggers and formatters and handlers is odd.

I would really just like to see a little more clarification on what
Turbogears sets up for you by default, and less reliance on someone
having read through all the logging module documentation (especially
given that the TG page suggests you only need to understand the first
page).

TG seems to set up 3 loggers: one named after your package, one called
allinfo, one called access. The docs copy-and-paste the content of the
config file, but don't explain why there are these 3 loggers. Are the
other two for internal use?

I guess I can just use "logging.getLogger('myapp.whatever') " and that
will be fine for my needs. It's just that the awkward examples, and
the extra stuff in the config files, and the extreme flexibility of
the logging module makes it a bit unclear how one goes about the most
simple logging tasks.

Cheers,
Ben Sizer

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to