newb: logging.getLogger('') and logging.getLogger("something")

J

johnny

For getLogger, can you pass anything in there and it will return a
object?
Would that returned object, be your root logger?

Thanks,
 
D

Dennis Lee Bieber

On 11 Dec 2006 15:45:33 -0800, "johnny" <[email protected]> declaimed
the following in gmane.comp.python.general:

WARNING: I'm in a rather cynical mood tonight -- Potential Flame
follows..
For getLogger, can you pass anything in there and it will return a
object?
Would that returned object, be your root logger?

Have you even read the documentation supplied with Python? I believe
you've mentioned an ActiveState install... On Windows that includes a
searchable Help file of all the Python standard documentation, plus
additional items (including a copy of "Dive Into Python" as I recall).

I ask as you've /started/ FOUR NEW topic threads in less than 2
hours. It begins to look almost as if your first action on any problem
is to post a new topic, rather than search the existing documentation. I
normally don't mind answering questions -- in some cases it acts as a
learning experience when it involves something I've not worked with
before; as I get to play with the library reference manual...

Creeping featurism in requirements don't help... If you'd managed to
get a discrete and complete set of requirements/use cases down, I
suspect most of us could have tossed off your application in about two
or three hours.



Now... for the question, as I understand it... From the help file:

-=-=-=-=-=-
getLogger( [name])

Return a logger with the specified name or, if no name is specified,
return a logger which is the root logger of the hierarchy. If specified,
the name is typically a dot-separated hierarchical name like "a", "a.b"
or "a.b.c.d". Choice of these names is entirely up to the developer who
is using logging.

All calls to this function with a given name return the same logger
instance. This means that logger instances never need to be passed
between different parts of an application.
-=-=-=-=-=-

I've never explicitly used the root logger; my top level has always
been: application-name, and then, for modules specific to the
application: application-name.module-name (and sometimes, if there are
multiple major functional blocks:
application-name.module-name.function-name)

So, something like...

ftppdf.thread#.ftp
ftppdf.thread#.db
ftppdf.thread#.convert

might be candidates... The main module might use just "ftppdf" to report
things like:

Starting thread #

--
Wulfraed Dennis Lee Bieber KD6MOG
(e-mail address removed) (e-mail address removed)
HTTP://wlfraed.home.netcom.com/
(Bestiaria Support Staff: (e-mail address removed))
HTTP://www.bestiaria.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top