Changeset 38beeab in sasview
- Timestamp:
- Apr 9, 2017 3:45:49 AM (8 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 797a2e8
- Parents:
- 5af6f58
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
run.py
r64ca561 r38beeab 14 14 """ 15 15 16 import os17 import sys18 16 import imp 19 17 import logging 20 18 import logging.config 19 import os 20 import sys 21 from contextlib import contextmanager 22 from os.path import join as joinpath 23 from os.path import abspath, dirname 21 24 22 from contextlib import contextmanager 23 from os.path import abspath, dirname, join as joinpath 25 from sasview.logger_config import SetupLogger 24 26 27 l = SetupLogger(__name__) 28 logger = l.config_development() 25 29 26 LOGGER_CONFIG_FILE = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'sasview/logging.ini')27 logging.config.fileConfig(LOGGER_CONFIG_FILE, disable_existing_loggers=True)28 logger = logging.getLogger(__name__)29 30 def update_all_logs_to_debug(logger):31 '''32 This updates all loggers and respective handlers to DEBUG33 '''34 for handler in logger.handlers or logger.parent.handlers:35 handler.setLevel(logging.DEBUG)36 for name,_ in logging.Logger.manager.loggerDict.items():37 logging.getLogger(name).setLevel(logging.DEBUG)38 39 30 def addpath(path): 40 31 """ … … 154 145 155 146 if __name__ == "__main__": 156 update_all_logs_to_debug(logger)147 logger.debug("Starting SASVIEW in debug mode.") 157 148 prepare() 158 149 from sas.sasview.sasview import run 159 150 run() 160 151 logger.debug("Ending SASVIEW in debug mode.") -
sasview/logging.ini
r64ca561 r38beeab 16 16 17 17 [formatter_detailed] 18 format=%(asctime)s :%(name)s:%(levelname)s: %(lineno)d: %(message)s18 format=%(asctime)s : %(levelname)s : %(name)s: %(lineno)d: %(message)s 19 19 20 20 ############################################################################### … … 27 27 class=logging.StreamHandler 28 28 formatter=simple 29 level= INFO29 level=WARNING 30 30 args=tuple() 31 31 32 32 [handler_log_file] 33 33 class=logging.FileHandler 34 level= INFO34 level=DEBUG 35 35 formatter=detailed 36 36 args=(os.path.join(os.path.expanduser("~"),'sasview.log'),"a") … … 43 43 44 44 [logger_root] 45 level= INFO45 level=DEBUG 46 46 formatter=default 47 47 handlers=console,log_file … … 60 60 61 61 [logger_sasgui] 62 level= INFO62 level=DEBUG 63 63 qualname=sas.sasgui 64 64 handlers=console,log_file -
sasview/sasview.py
r5af6f58 r38beeab 18 18 import traceback 19 19 20 logger = logging.getLogger(__name__) 21 if not logger.root.handlers: 22 # Scripts running under py2exe do not have a __file__ global. Detect this and use sys.argv[0] instead. 23 try: 24 LOGGER_CONFIG_FILE = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'logging.ini') 25 except NameError: # We are the main py2exe script, not a module 26 LOGGER_CONFIG_FILE = os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])), 'logging.ini') 27 logging.config.fileConfig(LOGGER_CONFIG_FILE, disable_existing_loggers=False) 28 logging.captureWarnings(True) 20 from logger_config import SetupLogger 21 22 l = SetupLogger(__name__) 23 logger = l.config_production() 29 24 30 25 # Log the start of the session -
src/sas/sasgui/guiframe/gui_manager.py
r49165488 r38beeab 77 77 # clean all these module variables and put them into a config class 78 78 # that can be passed by sasview.py. 79 logger. info(sys.executable)80 logger. info(str(sys.argv))79 logger.debug(sys.executable) 80 logger.debug(str(sys.argv)) 81 81 from sas import sasview as sasview 82 82 app_path = os.path.dirname(sasview.__file__) 83 logger. info("Using application path: %s", app_path)83 logger.debug("Using application path: %s", app_path) 84 84 return app_path 85 85 … … 109 109 if fObj is not None: 110 110 fObj.close() 111 logger. info("GuiManager loaded %s/%s" % (path, file))111 logger.debug("GuiManager loaded %s/%s" % (path, file)) 112 112 return config_module 113 113 … … 126 126 # Didn't find local config, load the default 127 127 import sas.sasgui.guiframe.config as config 128 logger. info("using default local_config")128 logger.debug("using default local_config") 129 129 else: 130 logger. info("found local_config in %s" % os.getcwd())130 logger.debug("found local_config in %s" % os.getcwd()) 131 131 else: 132 logger. info("found local_config in %s" % PATH_APP)132 logger.debug("found local_config in %s" % PATH_APP) 133 133 134 134 from sas.sasgui.guiframe.customdir import SetupCustom … … 139 139 if custom_config is None: 140 140 msgConfig = "Custom_config file was not imported" 141 logger. info(msgConfig)141 logger.debug(msgConfig) 142 142 else: 143 logger. info("using custom_config in %s" % os.getcwd())143 logger.debug("using custom_config in %s" % os.getcwd()) 144 144 else: 145 logger. info("using custom_config from %s" % c_conf_dir)145 logger.debug("using custom_config from %s" % c_conf_dir) 146 146 147 147 # read some constants from config … … 2156 2156 if response is not None: 2157 2157 try: 2158 #2159 2158 content = response.read().strip() 2160 logger.info("Connected to www.sasview.org. Latest version: %s" 2161 % (content)) 2159 logger.info("Connected to www.sasview.org. Latest version: %s", content) 2162 2160 version_info = json.loads(content) 2163 2161 except:
Note: See TracChangeset
for help on using the changeset viewer.