简体   繁体   中英

Where is python's logging.handlers.WatchedFileHandler?

I'm building a project with python 2.7, and would love to have my logs rotate (managed in the usual way by logrotate ). Python logging has a mechanism for handling this- WatchedFileHandler , however, I dont know how to install or where to find it!

.virtualenv/bin/python -c 'import logging; print logging.__version__'
> 0.5.1.2

this seems like the most current version, however, the handlers package is no where to be found. Am I going crazy?

You should not use the logging package from PyPI but just the built-in logging module:

>>> import logging.handlers
>>> logging.handlers.WatchedFileHandler
<class 'logging.handlers.WatchedFileHandler'>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM