python logging module:a quick question


L

Littlefield, Tyler

Hello all:
I have a basic server I am working on, and wanted some input with an
error I'm getting.
I am initializing the logger like so:
if __name__ == "__main__":
observer = log.PythonLoggingObserver()
observer.start()
logging.basicConfig(filename='logs/server.log', level=logging.DEBUG,
format='%(asctime)s [%(levelname)s] %(module)s:%(funcname)s:%(lineno)d
%(message)s')
logger = logging.getLogger()
logger.addHandler(logging.handlers.TimedRotatingFileHandler)
....
I get the following error:
File
"/home/gserver/alpine/lib/python2.7/site-packages/twisted/internet/protoc
ol.py", line 52, in doStart
log.msg("Starting factory %r" % self)
--- <exception caught here> ---
File
"/home/gserver/alpine/lib/python2.7/site-packages/twisted/python/log.py",
line 284, in msg
self.observers(actualEventDict)
File
"/home/gserver/alpine/lib/python2.7/site-packages/twisted/python/log.py",
line 532, in emit
self.logger.log(level, text)
File "/usr/local/lib/python2.7/logging/__init__.py", line 1195, in log
self._log(level, msg, args, **kwargs)
File "/usr/local/lib/python2.7/logging/__init__.py", line 1250, in _log
self.handle(record)
File "/usr/local/lib/python2.7/logging/__init__.py", line 1260, in handle
self.callHandlers(record)
File "/usr/local/lib/python2.7/logging/__init__.py", line 1299, in
callHandler
s
if record.levelno >= hdlr.level:
exceptions.AttributeError: type object 'TimedRotatingFileHandler' has no
attribute 'level'
I'm also curious how this rotating handler works. Will it just log to a
file per day for a week, then start rotating those out with newer ones?
Can I change the interval?

--

Take care,
Ty
Web: http://tds-solutions.net
The Aspen project: a light-weight barebones mud engine
http://code.google.com/p/aspenmud

Sent from my toaster.
 
Ad

Advertisements


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

Top