Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #18013 > unrolled thread

python logging module:a quick question

Started by"Littlefield, Tyler" <tyler@tysdomain.com>
First post2011-12-26 23:26 -0700
Last post2011-12-26 23:26 -0700
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python


Contents

  python logging module:a quick question "Littlefield, Tyler" <tyler@tysdomain.com> - 2011-12-26 23:26 -0700

#18013 — python logging module:a quick question

From"Littlefield, Tyler" <tyler@tysdomain.com>
Date2011-12-26 23:26 -0700
Subjectpython logging module:a quick question
Message-ID<mailman.4126.1324967582.27778.python-list@python.org>
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[i](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.

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web