Procházet zdrojové kódy

added logging to track down double loading problem

avkonst před 11 roky
rodič
revize
78846566a3

+ 5 - 0
mainline/metrixpp.py

@@ -58,6 +58,11 @@ def main():
 def start():
     ts = time.time()
     mpp.log.set_default_format()
+
+    # TODO remove, logging enabled at earlier stage to track down a problem with loader    
+    os.environ['METRIXPLUSPLUS_LOG_LEVEL'] = 'DEBUG'
+    logging.getLogger().setLevel(logging.DEBUG)
+    
     exit_code = main()
     time_spent = round((time.time() - ts), 2)
     if 'METRIXPLUSPLUS_TEST_GENERATE_GOLDS' in os.environ.keys() and \

+ 3 - 2
mainline/mpp/internal/dbwrap.py

@@ -709,6 +709,7 @@ class Database(object):
 
     def log(self, sql):
         if logging.getLogger().getEffectiveLevel() <= logging.DEBUG:
-            logging.debug("[" + str(self.id) + "] Executing query: " + sql)
-            traceback.print_stack()
+            pass
+            #logging.debug("[" + str(self.id) + "] Executing query: " + sql)
+            #traceback.print_stack()
         

+ 6 - 0
mainline/mpp/internal/loader.py

@@ -24,6 +24,7 @@ import sys
 import ConfigParser
 import re
 import optparse
+import logging
 
 class MultiOptionParser(optparse.OptionParser):
     
@@ -120,6 +121,8 @@ class Loader(object):
                 result.append(child)
             return result
 
+        logging.debug("Additional plugin loading locations: " + str(directories))
+
         # configure python path for loading
         std_ext_dir = os.path.join(os.environ['METRIXPLUSPLUS_INSTALL_DIR'], 'ext')
         std_ext_priority_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
@@ -143,6 +146,7 @@ class Loader(object):
         # load
         for plugin_name in required_and_dependant_plugins:
             item = inicontainer.hash[plugin_name]
+            logging.debug("Loading plugin: " + str(item['package']) + ' ' + str(item['module']))
             plugin = __import__(item['package'], globals(), locals(), [item['module']], -1)
             module_attr = plugin.__getattribute__(item['module'])
             class_attr = module_attr.__getattribute__(item['class'])
@@ -177,7 +181,9 @@ class Loader(object):
 
         for item in self.iterate_plugins():
             if (isinstance(item, mpp.api.IConfigurable)):
+                logging.debug("declaring options for " + item.get_name())
                 item.declare_configuration(optparser)
+                logging.debug("after has option std.code.lines.code " + str(optparser.has_option('--std.code.lines.code')))
 
         (options, args) = optparser.parse_args(args)
         for item in self.iterate_plugins():