X-Git-Url: http://git.maemo.org/git/?p=theonering;a=blobdiff_plain;f=src%2Ftheonering.py;h=f8a26f49da6f78d0b1ee29b70961fab37198f1a1;hp=4ac5700b07f95fd85da938dba23c07bbc7777a4f;hb=13e110dc28426fba921730b472a618ba5d51c6f5;hpb=1c45a9e938f2e17400ceb2958d69c8ae1aa9c63b diff --git a/src/theonering.py b/src/theonering.py index 4ac5700..f8a26f4 100755 --- a/src/theonering.py +++ b/src/theonering.py @@ -23,6 +23,7 @@ import os import sys import signal import logging +import logging.handlers import gobject import dbus.glib @@ -91,20 +92,16 @@ def main(logToFile): telepathy_utils.debug_divert_messages(os.getenv('THEONERING_LOGFILE')) logFormat = '(%(asctime)s) %(levelname)-5s %(threadName)s.%(name)s: %(message)s' + logging.basicConfig( + level=logging.DEBUG, + format=logFormat, + datefmt='%H:%M:%S', + ) logging.raiseExceptions = True # Getting funky shutdown behavior, checking it out - if logToFile: - logging.basicConfig( - level=logging.DEBUG, - filename=constants._user_logpath_, - format=logFormat, - datefmt='%H:%M:%S', - ) - else: - logging.basicConfig( - level=logging.DEBUG, - format=logFormat, - datefmt='%H:%M:%S', - ) + rotating = logging.handlers.RotatingFileHandler(constants._user_logpath_, maxBytes=512*1024, backupCount=1) + rotating.setFormatter(logging.Formatter(logFormat)) + root = logging.getLogger() + root.addHandler(rotating) logging.info("telepathy-theonering %s-%s" % (constants.__version__, constants.__build__)) logging.debug("OS: %s" % (os.uname()[0], )) logging.debug("Kernel: %s (%s) for %s" % os.uname()[2:])