import from the new logging package

L

Logan

Is there actually a good reason why the StreamHandler and the
FileHandler are in the core package and all other handlers are
in logging.handlers?

I first did not realize this when reading the documentation of
the logging package and wrote a script which used:

from logging import FileHandler

When I changed the script to use the 'RotatingFileHandler', I
did not figure out that I had to use

from logging.handlers import RotatingFileHandler

until I read the source code of the logging package. And only
after I had a look at 'handlers.py', I thought that this must
be described in the documentation; so I read the documentation
again and finally found it. (Well, actually on the first page,
but that page is quite long :)

So, yes, it was my fault (did not read the documentation line
by line). But: why was the package designed in that way?
 

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
474,172
Messages
2,570,933
Members
47,473
Latest member
ChristelPe

Latest Threads

Top