Author: dmeyer
Date: Sat Oct 13 10:16:30 2007
New Revision: 2858

Log:
use special feedmanager logfile

Modified:
   trunk/feedmanager/src/beacon/feeds.py

Modified: trunk/feedmanager/src/beacon/feeds.py
==============================================================================
--- trunk/feedmanager/src/beacon/feeds.py       (original)
+++ trunk/feedmanager/src/beacon/feeds.py       Sat Oct 13 10:16:30 2007
@@ -32,6 +32,7 @@
 # python imports
 import os
 import logging
+from logging.handlers import RotatingFileHandler
 
 # kaa imports
 import kaa.notifier
@@ -42,7 +43,6 @@
 # plugin config object
 config = kaa.feedmanager.config
 
-logging.getLogger('feedmanager').setLevel(logging.DEBUG)
 
 class IPC(object):
     """
@@ -86,6 +86,20 @@
     """
     Init the plugin.
     """
+    # configure logger
+    log = logging.getLogger('feedmanager')
+    log.setLevel(logging.DEBUG)
+
+    logfile = os.path.join(db.get_directory(), 'feedmanager/log')
+    if os.path.dirname(logfile) and not 
os.path.isdir(os.path.dirname(logfile)):
+        os.makedirs(os.path.dirname(logfile))
+    # create rotating log file with 1MB for each file with a backup of 3
+    handler = RotatingFileHandler(logfile, maxBytes=1000000, backupCount=3)
+    f = logging.Formatter('%(asctime)s %(levelname)-8s [%(name)6s] '+\
+                          '%(filename)s %(lineno)s: %(message)s')
+    handler.setFormatter(f)
+    log.addHandler(handler)
+
     # use ~/.beacon/feedmanager as base dir
     database = os.path.join(db.get_directory(), 'feedmanager')
     kaa.feedmanager.set_database(database)

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to