[svn-commits] pabelanger: branch group/python_logging r1984 - in /asterisk/team/group/pytho...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Aug 26 16:36:45 CDT 2011


Author: pabelanger
Date: Fri Aug 26 16:36:42 2011
New Revision: 1984

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=1984
Log:
Merge mjorden's patch

Added:
    asterisk/team/group/python_logging/logs/
Modified:
    asterisk/team/group/python_logging/lib/python/asterisk/TestCase.py
    asterisk/team/group/python_logging/lib/python/asterisk/sipp.py
    asterisk/team/group/python_logging/logger.conf
    asterisk/team/group/python_logging/runtests.py

Modified: asterisk/team/group/python_logging/lib/python/asterisk/TestCase.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/group/python_logging/lib/python/asterisk/TestCase.py?view=diff&rev=1984&r1=1983&r2=1984
==============================================================================
--- asterisk/team/group/python_logging/lib/python/asterisk/TestCase.py (original)
+++ asterisk/team/group/python_logging/lib/python/asterisk/TestCase.py Fri Aug 26 16:36:42 2011
@@ -41,15 +41,7 @@
             print "WARNING: no logging.conf file found; using default configuration"
             logging.basicConfig(level=self.defaultLogLevel)
 
-        """ File logger specific for this test - note that there should be a console logger by default """
-        logFormat = logging.Formatter("%(levelname)s\t%(asctime)s\t%(name)s::%(funcName)s[%(lineno)d]: %(message)s")
-        filePath = self.test_name + "/test-output.txt"
-        fh = logging.FileHandler(filePath, 'w')
-        fh.setFormatter(logFormat)
-
-        """ Attach the handler to the root logger - this applies it to things like starpy as well """
-        logging.getLogger().addHandler(fh)
-
+        logger.info("Executing " + self.test_name + "...")
         reactor.callWhenRunning(self.run)
 
     def create_asterisk(self, count=1):

Modified: asterisk/team/group/python_logging/lib/python/asterisk/sipp.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/group/python_logging/lib/python/asterisk/sipp.py?view=diff&rev=1984&r1=1983&r2=1984
==============================================================================
--- asterisk/team/group/python_logging/lib/python/asterisk/sipp.py (original)
+++ asterisk/team/group/python_logging/lib/python/asterisk/sipp.py Fri Aug 26 16:36:42 2011
@@ -95,7 +95,6 @@
         logger.debug("Executing SIPp scenario: %s" % scenario['scenario'])
         logger.debug(sipp_args)
 
-        #return subprocess.Popen(sipp_args)
         return subprocess.Popen(sipp_args,
                                 stdout=subprocess.PIPE, stderr=subprocess.PIPE)
 

Modified: asterisk/team/group/python_logging/logger.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/group/python_logging/logger.conf?view=diff&rev=1984&r1=1983&r2=1984
==============================================================================
--- asterisk/team/group/python_logging/logger.conf (original)
+++ asterisk/team/group/python_logging/logger.conf Fri Aug 26 16:36:42 2011
@@ -3,21 +3,37 @@
 #
 
 [loggers]
-keys=root
+keys=root,AMI,asterisk,TestCase
 
 [handlers]
-keys=stdout
+keys=stdout,normalFile,verboseFile
 
 [formatters]
 keys=default
 
-# Logger definitions.  Note that a default file handler will be
-# used for all loggers (as defined in TestCase).  See 
-# lib/python/asterisk/TestCase.py.  If additional handlers are desired,
+# Logger definitions. If additional logging handlers are desired,
 # they can be configured below this section.
 [logger_root]
-level=INFO
-handlers=stdout
+level=NOTSET
+handlers=stdout,normalFile,verboseFile
+
+[logger_AMI]
+level=NOTSET
+propagate=0
+handlers=stdout,normalFile,verboseFile
+qualname=AMI
+
+[logger_asterisk]
+level=NOTSET
+propagate=0
+handlers=stdout,normalFile,verboseFile
+qualname=asterisk
+
+[logger_TestCase]
+level=NOTSET
+propagate=0
+handlers=stdout,normalFile,verboseFile
+qualname=asterisk.TestCase
 
 [handler_stdout]
 class=StreamHandler
@@ -25,6 +41,17 @@
 formatter=default
 args=(sys.stdout,)
 
+[handler_normalFile]
+class=handlers.RotatingFileHandler
+level=INFO
+formatter=default
+args=('./logs/messages.log', 'a', 67108864, 5)
+[handler_verboseFile]
+class=handlers.RotatingFileHandler
+level=DEBUG
+formatter=default
+args=('./logs/full.log', 'a', 67108864, 10)
+
 # Formatter definitions for handlers defined in this configuration file
 [formatter_default]
 format='%(levelname)s    %(asctime)s    %(name)s::%(funcName)s[%(lineno)d]: %(message)s'

Modified: asterisk/team/group/python_logging/runtests.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/group/python_logging/runtests.py?view=diff&rev=1984&r1=1983&r2=1984
==============================================================================
--- asterisk/team/group/python_logging/runtests.py (original)
+++ asterisk/team/group/python_logging/runtests.py Fri Aug 26 16:36:42 2011
@@ -161,21 +161,14 @@
 
         if os.path.exists(cmd[0]) and os.access(cmd[0], os.X_OK):
             print "Running %s ..." % cmd
-            try:
-                f = open("%s/test-console-output.txt" % self.test_name, "w")
-            except IOError:
-                print "FAILURE: Failed to open file for test output"
-                return
             p = subprocess.Popen(cmd, stdout=subprocess.PIPE,
                                  stderr=subprocess.STDOUT)
             try:
                 for l in p.stdout.readlines():
-                    f.write(l)
                     print l,
             except IOError:
                 pass
             p.wait()
-            f.close()
 
             self.passed = (p.returncode == 0 and self.expectPass) or (p.returncode and not self.expectPass)
         else:




More information about the svn-commits mailing list