Hello Guys,
I'm having a little trouble modifying my logging so that the log files are rotated. I'm using the standard python logging module and can find some decent documentation on how to create and add a rotatingFileHandler to my logger but I've been unable to find out how to disable the standard File handler. I currently create my logger like this: logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(levelname)-8s %(message)s', datefmt='%a, %d %b %Y %H:%M:%S', filename='/var/log/ThinkBlue.log', filemode='a') What's the best way to change this so that ThinkBlue.log grows no larger than let's say 5mb and that we keep 5 archives of the log, I know I can create a new handler and add it to the logger like this: newlevel = logging.handlers.RotatingFileHandler('/var/log/ThinkBlue.log', 'a', 5000, 5) logging.getLogger('').addHandler(newlevel) But fear this will mean I'm writing to the log file twice, is that right? I need some help, am I going about this the correct way of is there a better way of doing this? Cheers guys, Rob
-- http://mail.python.org/mailman/listinfo/python-list