Changeset 5958

Show
Ignore:
Timestamp:
08/22/2010 01:17:38 PM (1 year ago)
Author:
ed
Message:

Switched all of Dabo's logging to standard Python logging. Now instead of calling:

dabo.infoLog.write("some message")
dabo.errorLog.write("some message")

...the calls will be:

dabo.log.info("some message")
dabo.log.error("some message")

I've also merged the dbActivityLog into the same common logging. It is no longer activated by the 'DatabaseActivityLog?' in dApp; instead, you must change the configuration before the app is run to include an actual file name to write to instead of the default of os.devnull.

I've converted all the old calls to the new style. There should be a lot of testing and a lot of feedback to improve this first step.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/dabo/__init__.py

    r5849 r5958  
    102102import locale 
    103103import logging 
     104import logging.handlers 
    104105try: 
    105106    import pysqlite2 
     
    127128from settings import * 
    128129 
    129 # Instantiate the logger object, which will send messages to user-overridable 
    130 # locations. Do this before any other imports. 
    131 from dabo.lib.logger import Log 
    132 infoLog = Log() 
    133 infoLog.Caption = "Dabo Info Log" 
    134 if verboseLogging: 
    135     infoLog.LogObject = sys.stdout 
    136 else: 
    137     class NullWrite(object): 
    138         def write(self, txt): pass 
    139     infoLog.LogObject = NullWrite() 
    140 errorLog = Log() 
    141 errorLog.Caption = "Dabo Error Log" 
    142 errorLog.LogObject = sys.stderr 
    143 # Create a separate log reference for event tracking. 
    144 eventLog = Log() 
    145 eventLog.Caption = "Dabo Event Log" 
    146 eventLog.LogObject = sys.stdout 
    147 # This log is set to None by default. It must be manually activated 
    148 # via the Application object. 
    149 dbActivityLog = Log() 
    150 dbActivityLog.Caption = "Database Activity Log" 
    151 dbActivityLog.LogObject = None 
     130_logConfFileName = "logging.conf" 
     131logConfFile = os.path.join(os.getcwd(), _logConfFileName) 
     132if not os.path.exists(logConfFile): 
     133    daboloc = os.path.dirname(__file__) 
     134    logConfFile = os.path.join(daboloc, _logConfFileName) 
     135import logging.config 
     136logging.config.fileConfig(logConfFile) 
     137 
     138log = logging.getLogger("dabo.mainLog") 
     139dbActivityLog = logging.getLogger("dabo.dbActivityLog") 
     140consoleLog = fileLog = dbLog = None 
     141for _handler in log.handlers: 
     142    try: 
     143        _handler.baseFilename 
     144        fileLog = _handler 
     145    except AttributeError: 
     146        consoleLog = _handler 
     147for _handler in dbActivityLog.handlers: 
     148    try: 
     149        _handler.baseFilename 
     150        dbLog = _handler 
     151        break 
     152    except AttributeError: 
     153        pass 
     154 
     155 
     156######################################################## 
     157#### The commented out code was a first attempt at using Python logging, but with 
     158#### the dabo.settings file being used to configure instead of logging.conf 
     159######################################################## 
     160# logConsoleHandler = logging.StreamHandler() 
     161# logConsoleHandler.setLevel(logConsoleLevel) 
     162# logFileHandler = logging.handlers.RotatingFileHandler(filename=logFile, maxBytes=maxLogFileSize, 
     163#       encoding=defaultEncoding) 
     164# logFileHandler.setLevel(logFileLevel) 
     165# consoleFormatter = logging.Formatter(consoleFormat) 
     166# fileFormatter = logging.Formatter(fileFormat) 
     167# logConsoleHandler.setFormatter(consoleFormatter) 
     168# logFileHandler.setFormatter(fileFormatter) 
     169# log = logging.getLogger(logName) 
     170# log.setLevel(logging.DEBUG) 
     171# log.addHandler(logConsoleHandler) 
     172# log.addHandler(logFileHandler) 
     173#  
     174# This log is set to the null output device ('nul' on Windows; /dev/null on the rest) 
     175# dbActivityLog = logging.getLogger("dabo.dbActivityLog") 
     176# dbLogHandler = logging.handlers.RotatingFileHandler(filename=dbLogFile, maxBytes=maxLogFileSize, 
     177#       encoding=defaultEncoding) 
     178# dbActivityLog.addHandler(dbLogHandler) 
     179# dbActivityLog.setLevel(dbLogFileLevel) 
     180# dbLogHandler.setLevel(dbLogFileLevel) 
     181######################################################## 
    152182 
    153183# Install localization service for dabo. dApp will install localization service 
  • trunk/dabo/biz/dBizobj.py

    r5915 r5958  
    428428            except StandardError, e: 
    429429                # Need to record what sort of error could be thrown 
    430                 dabo.errorLog.write(_("Failed to set RowNumber. Error: %s") % e) 
     430                dabo.log.error(_("Failed to set RowNumber. Error: %s") % e) 
    431431 
    432432 
     
    832832                except StandardError, e: 
    833833                    # Reset things and bail 
    834                     dabo.errorLog.write(_("Error in scanChangedRows: %s") % e) 
     834                    dabo.log.error(_("Error in scanChangedRows: %s") % e) 
    835835                    self._CurrentCursor = old_currentCursorKey 
    836836                    self._positionUsingPK(old_pk) 
  • trunk/dabo/dApp.py

    r5849 r5958  
    294294            except urllib2.URLError, e: 
    295295                # Cannot sync; record the error and move on 
    296                 dabo.errorLog.write(_("File re-sync failed. Reason: %s") % e) 
     296                dabo.log.error(_("File re-sync failed. Reason: %s") % e) 
    297297 
    298298 
     
    406406        self.closeConnections() 
    407407        self._tempFileHolder.release() 
    408         dabo.infoLog.write(_("Application finished.")) 
     408        dabo.log.info(_("Application finished.")) 
    409409        self._finished = True 
    410410        self.afterFinish() 
     
    579579            except urllib2.URLError, e: 
    580580                # Could not connect 
    581                 dabo.errorLog.write(_("Could not connect to the Dabo servers: %s") % e) 
     581                dabo.log.error(_("Could not connect to the Dabo servers: %s") % e) 
    582582                return e 
    583583            except ValueError: 
    584584                pass 
    585585            except StandardError, e: 
    586                 dabo.errorLog.write(_("Failed to open URL '%(url)s'. Error: %(e)s") % locals()) 
     586                dabo.log.error(_("Failed to open URL '%(url)s'. Error: %(e)s") % locals()) 
    587587                return e 
    588588            if simplejson: 
     
    605605        except StandardError, e: 
    606606            # No internet access, or Dabo site is down. 
    607             dabo.errorLog.write(_("Cannot access the Dabo site. Error: %s") % e) 
     607            dabo.log.error(_("Cannot access the Dabo site. Error: %s") % e) 
    608608            self._resetWebUpdateCheck() 
    609609            return None 
     
    622622        if not zipfiles: 
    623623            # No updates available 
    624             dabo.infoLog.write(_("No changed files available.")) 
     624            dabo.log.info(_("No changed files available.")) 
    625625            return 
    626626        projects = ("dabo", "demo", "ide") 
     
    729729        if newFile: 
    730730            file(pth, "w").write(newFile) 
    731             dabo.infoLog.write(_("File %s updated") % pth) 
     731            dabo.log.info(_("File %s updated") % pth) 
    732732 
    733733 
     
    940940            self.dbConnectionDefs[k] = v 
    941941 
    942         dabo.infoLog.write(_("%s database connection definition(s) loaded.") 
     942        dabo.log.info(_("%s database connection definition(s) loaded.") 
    943943            % (len(self.dbConnectionDefs))) 
    944944 
     
    989989        else: 
    990990            # Custom app code or the dabo.ui module already set this: don't touch 
    991             dabo.infoLog.write(_("User interface already set to '%s', so dApp didn't touch it.") 
     991            dabo.log.info(_("User interface already set to '%s', so dApp didn't touch it.") 
    992992                    % self.UI) 
    993993 
     
    998998            connDefs = importConnections(filePath, useHomeDir=True) 
    999999        except SAXParseException, e: 
    1000             dabo.errorLog.write(_("Error parsing '%(filePath)s': %(e)s") % locals()) 
     1000            dabo.log.error(_("Error parsing '%(filePath)s': %(e)s") % locals()) 
    10011001            return {} 
    10021002        # Convert the connect info dicts to dConnectInfo instances: 
     
    10861086        stdDirs = self._standardDirs + ("main.py", ) 
    10871087        if dirname not in stdDirs: 
    1088             dabo.errorLog.write(_("Non-standard directory '%s' requested") % dirname) 
     1088            dabo.log.error(_("Non-standard directory '%s' requested") % dirname) 
    10891089            return None 
    10901090        osp = os.path 
     
    13251325                pass 
    13261326        if not ret: 
    1327             dabo.infoLog.write(_("WARNING: No BasePrefKey has been set for this application.")) 
     1327            dabo.log.info(_("WARNING: No BasePrefKey has been set for this application.")) 
    13281328            try: 
    13291329                f = inspect.stack()[-1][1] 
     
    13571357 
    13581358 
    1359     def _getDatabaseActivityLog(self): 
    1360         return dabo.dbActivityLog.LogObject 
    1361  
    1362     def _setDatabaseActivityLog(self, val): 
    1363         if isinstance(val, basestring): 
    1364             try: 
    1365                 f = open(val, "a") 
    1366             except IOError, e: 
    1367                 dabo.errorLog.write(_("Could not open file: '%(val)s': %(e)s") % locals()) 
    1368                 return 
    1369         else: 
    1370             f = val 
    1371         dabo.dbActivityLog.LogObject = f 
     1359#   def _getDatabaseActivityLog(self): 
     1360#       return dabo.dbActivityLog 
     1361#  
     1362#   def _setDatabaseActivityLog(self, val): 
     1363#       try: 
     1364#           dbLogger = dabo.dbActivityLog 
     1365#           for hnd in dbLogger.handlers: 
     1366#               dbLogger.removeHandler(hnd) 
     1367#           dabo.dbLogHandler = logging.handlers.RotatingFileHandler(filename=val, 
     1368#                   maxBytes=dabo.maxLogFileSize, encoding=self.Encoding) 
     1369#           dbLogger.addHandler(dabo.dbLogHandler) 
     1370#           dbLogger.setLevel(logging.INFO) 
     1371#           dabo.dbLogHandler.setLevel(logging.INFO) 
     1372#       except IOError, e: 
     1373#           dabo.log.error(_("Could not open file: '%(val)s': %(e)s") % locals()) 
     1374#           return 
    13721375 
    13731376 
     
    14461449                            # HomeDirectory the location of the main script, since we can't guess at 
    14471450                            # the application's directory structure. 
    1448                             dabo.infoLog.write("Can't deduce HomeDirectory:setting to the script directory.") 
     1451                            dabo.log.info("Can't deduce HomeDirectory:setting to the script directory.") 
    14491452                            hd = scriptDir 
    14501453 
     
    14601463            self._homeDirectory = os.path.abspath(val) 
    14611464        else: 
    1462             dabo.errorLog.write(_("Setting App HomeDirectory: Path does not exist. '%s'") % val) 
     1465            dabo.log.error(_("Setting App HomeDirectory: Path does not exist. '%s'") % val) 
    14631466 
    14641467 
     
    16171620            if uiType is None: 
    16181621                self._uiAlreadySet = True 
    1619                 dabo.infoLog.write(_("User interface set set to None.")) 
     1622                dabo.log.info(_("User interface set set to None.")) 
    16201623            elif dabo.ui.loadUI(uiType): 
    16211624                self._uiAlreadySet = True 
    1622                 dabo.infoLog.write(_("User interface set to '%s' by dApp.") % uiType) 
     1625                dabo.log.info(_("User interface set to '%s' by dApp.") % uiType) 
    16231626            else: 
    1624                 dabo.infoLog.write(_("Tried to set UI to '%s', but it failed.") % uiType) 
     1627                dabo.log.info(_("Tried to set UI to '%s', but it failed.") % uiType) 
    16251628        else: 
    16261629            raise RuntimeError(_("The UI cannot be reset once assigned.")) 
     
    16871690            any previous crypto objects are released. Write-only.  (varies)""")) 
    16881691 
    1689   DatabaseActivityLog = property(_getDatabaseActivityLog, _setDatabaseActivityLog, None, 
    1690           _("""Path to the file (or file-like object) to be used for logging all database 
    1691           activity. Default=None, which means no log is kept.   (file or str)""")) 
     1692#     DatabaseActivityLog = property(_getDatabaseActivityLog, _setDatabaseActivityLog, None, 
     1693#             _("""Path to the file (or file-like object) to be used for logging all database 
     1694#             activity. Default=None, which means no log is kept.   (file or str)""")) 
    16921695 
    16931696    DefaultMenuBarClass = property(_getDefaultMenuBarClass, _setDefaultMenuBarClass, None, 
  • trunk/dabo/dEvents.py

    r5751 r5958  
    11# -*- coding: utf-8 -*- 
     2import logging 
    23import time 
    34import dabo 
     
    9394            for logEventName in logEvents: 
    9495                if logEventName.lower() == "all" or logEventName == eventName: 
    95                     dabo.eventLog.write("dEvent Fired: %s %s" % 
     96                    holdLevel = dabo.log.level 
     97                    dabo.log.setLevel(logging.INFO) 
     98                    dabo.log.info("dEvent Fired: %s %s" % 
    9699                            (self._eventObject.getAbsoluteName(), 
    97100                            self.__class__.__name__,)) 
     101                    dabo.log.setLevel(holdLevel) 
    98102                    break 
    99103 
  • trunk/dabo/dLocalize.py

    r5917 r5958  
    8383        except IOError: 
    8484            # No translation file found 
    85             dabo.errorLog.write(""" 
     85            dabo.log.error(""" 
    8686No translation file found for domain 'dabo'. 
    8787    Locale dir = %s 
     
    9595            translation = gettext.translation(domain, localedir, languages=lang, codeset=charset) 
    9696        except IOError: 
    97             dabo.errorLog.write("No translation found for domain '%s' and language %s." % (domain, lang)) 
    98             dabo.errorLog.write(""" 
     97            dabo.log.error("No translation found for domain '%s' and language %s." % (domain, lang)) 
     98            dabo.log.error(""" 
    9999No translation file found for domain '%s'. 
    100100    Locale dir = %s 
  • trunk/dabo/dObject.py

    r5828 r5958  
    252252            except SyntaxError, e: 
    253253                snm = self.Name 
    254                 dabo.errorLog.write(_("Method '%(nm)s' of object '%(snm)s' has the following error: %(e)s") % locals()) 
     254                dabo.log.error(_("Method '%(nm)s' of object '%(snm)s' has the following error: %(e)s") % locals()) 
    255255                continue 
    256256            # OK, we have the compiled code. Add it to the class definition. 
  • trunk/dabo/dPref.py

    r5911 r5958  
    1818        #      descends from dObject, which needs to load dPref.py first. 
    1919        warnings.warn("Class dPref requires package 'pysqlite2'.") 
    20         #dabo.errorLog.write("This class requires SQLite") 
     20        #dabo.log.error("This class requires SQLite") 
    2121 
    2222# We don't want to deal with these as preferences. 
     
    214214        if not baseKey: 
    215215            if not self._persistAll: 
    216                 dabo.errorLog.write(_("No base key set; preference will not be persisted.")) 
     216                dabo.log.error(_("No base key set; preference will not be persisted.")) 
    217217                return 
    218218            else: 
     
    224224            typ = self._typeDict[type(val)] 
    225225        except KeyError: 
    226             dabo.errorLog.write(_("BAD TYPE: %s") % type(val)) 
     226            dabo.log.error(_("BAD TYPE: %s") % type(val)) 
    227227            typ = "?" 
    228228        # Convert it to a string that can be properly converted back 
  • trunk/dabo/db/dBackend.py

    r5911 r5958  
    203203        """ Begin a SQL transaction. Override in subclasses if needed.""" 
    204204        self._connection.begin() 
    205         dabo.dbActivityLog.write("SQL: begin") 
     205        dabo.dbActivityLog.info("SQL: begin") 
    206206        return True 
    207207 
     
    210210        """ Commit a SQL transaction.""" 
    211211        self._connection.commit() 
    212         dabo.dbActivityLog.write("SQL: commit") 
     212        dabo.dbActivityLog.info("SQL: commit") 
    213213        return True 
    214214 
     
    217217        """ Roll back (revert) a SQL transaction.""" 
    218218        self._connection.rollback() 
    219         dabo.dbActivityLog.write("SQL: rollback") 
     219        dabo.dbActivityLog.info("SQL: rollback") 
    220220        return True 
    221221 
  • trunk/dabo/db/dConnectInfo.py

    r5759 r5958  
    191191                    raise ValueError("Invalid database type: %s." % nm) 
    192192            except ImportError: 
    193                 dabo.errorLog.write(_("You do not have the database module for %s installed") % dbType) 
     193                dabo.log.error(_("You do not have the database module for %s installed") % dbType) 
    194194                self._dbType = None 
    195195                self._backendObject = None 
  • trunk/dabo/db/dCursorMixin.py

    r5913 r5958  
    256256                except Exception, e: 
    257257                    tfv = type(field_val) 
    258                     dabo.infoLog.write(_("_correctFieldType() failed for field: '%(field_name)s'; value: '%(field_val)s'; type: '%(tfv)s'") 
     258                    dabo.log.info(_("_correctFieldType() failed for field: '%(field_name)s'; value: '%(field_val)s'; type: '%(tfv)s'") 
    259259                            % locals()) 
    260260 
     
    277277                            # change self.Encoding and log the message 
    278278                            self.Encoding = enc 
    279                             dabo.errorLog.write(_("Field %(fname)s: Incorrect unicode encoding set; using '%(enc)s' instead") 
     279                            dabo.log.error(_("Field %(fname)s: Incorrect unicode encoding set; using '%(enc)s' instead") 
    280280                                % {'fname':field_name, 'enc':enc} ) 
    281281                            return ret 
     
    287287 
    288288            rfv = repr(field_val) 
    289             dabo.errorLog.write(_("%(rfv)s couldn't be converted to %(pythonType)s (field %(field_name)s)") 
     289            dabo.log.error(_("%(rfv)s couldn't be converted to %(pythonType)s (field %(field_name)s)") 
    290290                    % locals()) 
    291291        return ret 
     
    310310                if not self.IsPrefCursor: 
    311311                    try: 
    312                         dabo.dbActivityLog.write("SQL: %s, PARAMS: %s" % ( 
     312                        dabo.dbActivityLog.info("SQL: %s, PARAMS: %s" % ( 
    313313                                sql.decode(self.Encoding).replace("\n", " "), 
    314314                                ', '.join("%s" % p for p in params))) 
    315315                    except StandardError: 
    316316                        # A problem with writing to the log, most likely due to encoding issues 
    317                         dabo.dbActivityLog.write("FAILED SQL: %s") 
     317                        dabo.dbActivityLog.info("FAILED SQL: %s") 
    318318            else: 
    319319                res = self.superCursor.execute(self, sql) 
    320320                if not self.IsPrefCursor: 
    321                     dabo.dbActivityLog.write("SQL: %s" % ( 
     321                    dabo.dbActivityLog.info("SQL: %s" % ( 
    322322                            sql.decode(self.Encoding).replace("\n", " "),)) 
    323323        except Exception, e: 
     
    329329            if params: 
    330330                try: 
    331                     dabo.dbActivityLog.write("FAILED SQL: %s, PARAMS: %s" % ( 
     331                    dabo.dbActivityLog.info("FAILED SQL: %s, PARAMS: %s" % ( 
    332332                            sql.decode(self.Encoding).replace("\n", " "), 
    333333                            ', '.join("%s" % p for p in params))) 
    334334                except StandardError: 
    335335                    # A problem with writing to the log, most likely due to encoding issues 
    336                     dabo.dbActivityLog.write("FAILED SQL: %s") 
     336                    dabo.dbActivityLog.info("FAILED SQL: %s") 
    337337            else: 
    338                 dabo.dbActivityLog.write("FAILED SQL: %s" % ( 
     338                dabo.dbActivityLog.info("FAILED SQL: %s" % ( 
    339339                        sql.decode(self.Encoding).replace("\n", " "),)) 
    340340            # Database errors need to be decoded from database encoding. 
     
    351351                raise dException.DBNoAccessException(errMsg) 
    352352            else: 
    353                 dabo.dbActivityLog.write
     353                dabo.dbActivityLog.info
    354354                        _("DBQueryException encountered in execute(): %s\n%s") % (errMsg, sql)) 
    355355                raise dException.DBQueryException(errMsg) 
     
    376376            except UnicodeError: 
    377377                errMsg = unicode(e) 
    378             dabo.errorLog.write("Error fetching records: %s" % errMsg) 
     378            dabo.log.error("Error fetching records: %s" % errMsg) 
    379379 
    380380        if _records and not self.BackendObject._alreadyCorrectedFieldTypes: 
     
    10041004                    sft, stv = ustr(fldType), ustr(type(val)) 
    10051005                    msg = _("!!! Data Type Mismatch: field=%(fld)s. Expecting: %(sft)s; got: %(stv)s") % locals() 
    1006                     dabo.errorLog.write(msg) 
     1006                    dabo.log.error(msg) 
    10071007 
    10081008        # If the new value is different from the current value, change it and also 
     
    10561056                    self._clearMemento(row) 
    10571057            else: 
    1058                 dabo.infoLog.write("Field value changed, but the memento" 
     1058                dabo.log.info("Field value changed, but the memento" 
    10591059                        " can't be saved, because there is no valid KeyField.") 
    10601060 
     
    13251325                except UnicodeError: 
    13261326                    errMsg = unicode(e) 
    1327                 dabo.dbActivityLog.write
     1327                dabo.dbActivityLog.info
    13281328                        _("DBQueryException encountered in save(): %s") % errMsg) 
    13291329                raise e 
     
    13311331                errMsg = ustr(e) 
    13321332                if "connect" in errMsg.lower(): 
    1333                     dabo.dbActivityLog.write
     1333                    dabo.dbActivityLog.info
    13341334                            _("Connection Lost exception encountered in saverow(): %s") % errMsg) 
    13351335                    raise dException.ConnectionLostException(errMsg) 
     
    17611761                    newval = typ() 
    17621762                except Exception, e: 
    1763                     dabo.errorLog.write(_("Failed to create newval for field '%s'") % field_alias) 
    1764                     dabo.errorLog.write(ustr(e)) 
     1763                    dabo.log.error(_("Failed to create newval for field '%s'") % field_alias) 
     1764                    dabo.log.error(ustr(e)) 
    17651765                    newval = u"" 
    17661766 
  • trunk/dabo/db/dDataSet.py

    r5911 r5958  
    295295        if len(ds) == 0: 
    296296            # Can't create and populate a table without a structure 
    297             dabo.errorLog.write(_("Cannot populate without data for alias '%s'") 
     297            dabo.log.error(_("Cannot populate without data for alias '%s'") 
    298298                    % alias) 
    299299            return None 
  • trunk/dabo/db/dbFirebird.py

    r5911 r5958  
    3636                    # use type_conv=300 for blob encoding 
    3737                    kinterbasdb.init(type_conv=300) 
    38                     dabo.dbActivityLog.write("kinterbasdb.init(type_conv=300)") 
     38                    dabo.dbActivityLog.info("kinterbasdb.init(type_conv=300)") 
    3939                else: 
    4040                    kinterbasdb.init(type_conv=200) 
    41                     dabo.dbActivityLog.write("kinterbasdb.init(type_conv=200)") 
     41                    dabo.dbActivityLog.info("kinterbasdb.init(type_conv=200)") 
    4242            if initialized is None: 
    4343                # Older versions of kinterbasedb didn't have this attribute, so we write 
     
    210210        if not self._connection._has_transaction(): 
    211211            self._connection.begin() 
    212             dabo.dbActivityLog.write("SQL: begin") 
     212            dabo.dbActivityLog.info("SQL: begin") 
    213213            ret = True 
    214214        return ret 
     
    220220        """ 
    221221        self._connection.commit() 
    222         dabo.dbActivityLog.write("SQL: commit") 
     222        dabo.dbActivityLog.info("SQL: commit") 
    223223 
    224224     
     
    267267            cursor.execute(sql) 
    268268            ret = cursor.getFieldVal("nextval") 
    269         dabo.dbActivityLog.write("SQL: result of pregenPK: %d" % ret) 
     269        dabo.dbActivityLog.info("SQL: result of pregenPK: %d" % ret) 
    270270        return ret 
    271271     
  • trunk/dabo/db/dbMySQL.py

    r5911 r5958  
    9090        """ Begin a SQL transaction.""" 
    9191        cursor.execute("START TRANSACTION") 
    92         dabo.dbActivityLog.write("SQL: begin") 
     92        dabo.dbActivityLog.info("SQL: begin") 
    9393        return True 
    9494 
     
    9797        """ Commit a SQL transaction.""" 
    9898        cursor.execute("COMMIT") 
    99         dabo.dbActivityLog.write("SQL: commit") 
     99        dabo.dbActivityLog.info("SQL: commit") 
    100100        return True 
    101101 
     
    104104        """ Rollback a SQL transaction.""" 
    105105        cursor.execute("ROLLBACK") 
    106         dabo.dbActivityLog.write("SQL: rollback") 
     106        dabo.dbActivityLog.info("SQL: rollback") 
    107107        return True 
    108108 
  • trunk/dabo/db/dbOracle.py

    r5911 r5958  
    154154        if not self._connection._has_transaction(): 
    155155            self._connection.begin() 
    156             dabo.dbActivityLog.write("SQL: begin") 
     156            dabo.dbActivityLog.info("SQL: begin") 
    157157            ret = True 
    158158        return ret 
  • trunk/dabo/db/dbPostgreSQL.py

    r5911 r5958  
    8787            encoding = self._encodings[encoding] 
    8888        except KeyError: 
    89             dabo.dbActivityLog.write("unknown encoding %r" % encoding) 
     89            dabo.dbActivityLog.info("unknown encoding %r" % encoding) 
    9090        if self._connection.encoding != encoding: 
    9191            try: 
    9292                self._connection.set_client_encoding(encoding) 
    9393            except Exception: 
    94                 dabo.dbActivityLog.write("cannot set database client encoding") 
     94                dabo.dbActivityLog.info("cannot set database client encoding") 
    9595        return encoding 
    9696 
    9797 
    9898    def beginTransaction(self, cursor): 
    99         dabo.dbActivityLog.write("SQL: begin (implicit, nothing done)") 
     99        dabo.dbActivityLog.info("SQL: begin (implicit, nothing done)") 
    100100        return True 
    101101 
     
    213213        """ 
    214214        self.commitTransaction(cursor) 
    215         dabo.dbActivityLog.write("SQL: Commit") 
     215        dabo.dbActivityLog.info("SQL: Commit") 
    216216 
    217217 
  • trunk/dabo/db/dbSQLite.py

    r5911 r5958  
    9797        """ 
    9898        cursor.execute("BEGIN") 
    99         dabo.dbActivityLog.write("SQL: begin") 
     99        dabo.dbActivityLog.info("SQL: begin") 
    100100        return True 
    101101 
     
    106106        try: 
    107107            cursor.execute("COMMIT", errorClass=opError) 
    108             dabo.dbActivityLog.write("SQL: commit") 
     108            dabo.dbActivityLog.info("SQL: commit") 
    109109            return True 
    110110        except opError, e: 
     
    116116            except UnicodeError: 
    117117                errMsg = unicode(e) 
    118             dabo.dbActivityLog.write("SQL: commit failed: %s" % errMsg) 
     118            dabo.dbActivityLog.info("SQL: commit failed: %s" % errMsg) 
    119119            raise dException.DBQueryException(errMsg) 
    120120 
     
    123123        """ Rollback a SQL transaction.""" 
    124124        cursor.execute("ROLLBACK") 
    125         dabo.dbActivityLog.write("SQL: rollback") 
     125        dabo.dbActivityLog.info("SQL: rollback") 
    126126        return True 
    127127 
    128128     
    129129    def flush(self, crs): 
    130         dabo.dbActivityLog.write("SQL: flush") 
     130        dabo.dbActivityLog.info("SQL: flush") 
    131131        self._connection.commit() 
    132132 
  • trunk/dabo/lib/RemoteConnector.py

    r5915 r5958  
    6161            if reRaise: 
    6262                raise 
    63             dabo.errorLog.write("HTTPError: %s" % e) 
     63            dabo.log.error("HTTPError: %s" % e) 
    6464            return None 
    6565        ret = res.read() 
     
    191191            errText = e.read() 
    192192            errMsg = "\n".join(errText.splitlines()[4:]) 
    193             dabo.errorLog.write(_("HTTP Error getting app list: %s") % e) 
     193            dabo.log.error(_("HTTP Error getting app list: %s") % e) 
    194194            raise 
    195195        # If they passed an app name, and it's in the returned app list, run it 
     
    257257                return homedir 
    258258            else: 
    259                 dabo.errorLog.write(_("HTTP Error syncing files: %s") % e) 
     259                dabo.log.error(_("HTTP Error syncing files: %s") % e) 
    260260                return 
    261261        except urllib2.URLError: 
     
    289289                res = self.UrlOpener.open(url) 
    290290            except urllib2.HTTPError, e: 
    291                 dabo.errorLog.write(_("HTTP Error retrieving files: %s") % e) 
     291                dabo.log.error(_("HTTP Error retrieving files: %s") % e) 
    292292            # res holds a zip file 
    293293            f = StringIO(res.read()) 
  • trunk/dabo/lib/datanav/Page.py

    r5915 r5958  
    431431            chc = (_(CHOICE_TRUE), _(CHOICE_FALSE)) 
    432432        else: 
    433             dabo.errorLog.write(_("Type '%s' not recognized.") % typ) 
     433            dabo.log.error(_("Type '%s' not recognized.") % typ) 
    434434            chc = () 
    435435        return chc 
  • trunk/dabo/lib/logger.py

    r5915 r5958  
    1515 
    1616    So, to display general informational messages, call: 
    17         dabo.infoLog.write("message") 
     17        dabo.log.info("message") 
    1818 
    1919    For error messages, call: 
    20         dabo.errorLog.write("message") 
     20        dabo.log.error("message") 
    2121 
    2222    By default, infoLog writes to stdout and errorLog to stderr. But your code 
  • trunk/dabo/settings.py

    r5681 r5958  
    33import os 
    44import sys 
     5import logging 
    56 
    67# Dabo Global Settings 
     
    180181webupdate_urlbase = "http://daboserver.com/webupdate" 
    181182 
     183######################################################## 
     184#### The commented out code was a first attempt at using Python logging, but with 
     185#### the dabo.settings file being used to configure instead of logging.conf 
     186######################################################## 
     187# Logging settings 
     188# logLevel = logging.DEBUG 
     189# logFile = "dabo.log" 
     190# logConsoleLevel = logging.ERROR 
     191# logFileLevel = logging.ERROR 
     192# logName = "DaboLog" 
     193# consoleFormat = "%(asctime)s - %(levelname)s - %(message)s" 
     194# fileFormat = "%(asctime)s - %(levelname)s - %(message)s" 
     195# # Set the db file to the null device initially 
     196# dbLogFile = os.devnull 
     197# dbLogFileLevel = logging.DEBUG 
     198# maxLogFileSize = 5242880      # 5 MB 
     199######################################################## 
     200 
    182201 
    183202### Settings - end 
     203 
    184204 
    185205# Make sure that the current directory is in the sys.path 
  • trunk/dabo/ui/__init__.py

    r5828 r5958  
    6868            pass 
    6969        else: 
    70             dabo.infoLog.write(_("Cannot change the uiType to '%(typ)s', because UI '%(currType)s' is already loaded.") 
     70            dabo.log.info(_("Cannot change the uiType to '%(typ)s', because UI '%(currType)s' is already loaded.") 
    7171                    % locals()) 
    7272    return retVal 
     
    8585 
    8686if __defaultUI: 
    87     dabo.infoLog.write(_("Automatically loading default ui '%s'...") % __defaultUI) 
     87    dabo.log.info(_("Automatically loading default ui '%s'...") % __defaultUI) 
    8888    # For now, don't do the tempting option: 
    8989    #loadUI(defaultUI) 
     
    9595else: 
    9696    pass 
    97     #dabo.infoLog.write(_("No default UI set. (DABO_DEFAULT_UI)")) 
     97    #dabo.log.info(_("No default UI set. (DABO_DEFAULT_UI)")) 
    9898 
    9999     
  • trunk/dabo/ui/dDataControlMixinBase.py

    r5916 r5958  
    247247                                exec ("src.%s = curVal" % self.DataField) 
    248248                            except StandardError, e: 
    249                                 dabo.errorLog.write("Could not bind to '%s.%s'\nReason: %s" % (self.DataSource, self.DataField, e) ) 
     249                                dabo.log.error("Could not bind to '%s.%s'\nReason: %s" % (self.DataSource, self.DataField, e) ) 
    250250                        else: 
    251251                            # The source is a direct object reference 
     
    257257                                else: 
    258258                                    nm = ustr(self.DataSource) 
    259                                 dabo.errorLog.write("Could not bind to '%s.%s'\nReason: %s" % (nm, self.DataField, e) ) 
     259                                dabo.log.error("Could not bind to '%s.%s'\nReason: %s" % (nm, self.DataField, e) ) 
    260260            self._oldVal = curVal 
    261261            self._from_flushValue = True 
     
    311311            return "L" 
    312312        else: 
    313             dabo.infoLog.write(_("getShortDataType - unknown type: %s") % (value,)) 
     313            dabo.log.info(_("getShortDataType - unknown type: %s") % (value,)) 
    314314            return "?" 
    315315 
     
    459459                    if not isinstance(ds, (dObject, dPref)): 
    460460                        # Warn about possible unsupported behavior. 
    461                         dabo.infoLog.write(_("DataSource '%s' does not inherit from a proper Dabo class. This may result in unsupported problems.") % ds.__repr__()) 
     461                        dabo.log.info(_("DataSource '%s' does not inherit from a proper Dabo class. This may result in unsupported problems.") % ds.__repr__()) 
    462462                    else: 
    463463                        self._srcIsBizobj = isinstance(ds, dabo.biz.dBizobj) 
  • trunk/dabo/ui/uitk/__init__.py

    r3199 r5958  
    44from uiApp import uiApp 
    55 
    6 dabo.infoLog.write("The Tkinter module is experimental only, and doesn't work. You've been warned.") 
     6dabo.log.info("The Tkinter module is experimental only, and doesn't work. You've been warned.") 
    77uiType = {'shortName': 'tk', 'moduleName': 'uitk', 'longName': 'Tkinter'} 
    88 
  • trunk/dabo/ui/uitk/dFormMixin.py

    r5916 r5958  
    5151#               exec(self.debugText) 
    5252#           except:  
    53 #               dabo.infoLog.write(_("Could not execute: %s") % self.debugText) 
     53#               dabo.log.info(_("Could not execute: %s") % self.debugText) 
    5454#       dlg.Destroy()    
    5555#  
  • trunk/dabo/ui/uitk/dPemMixin.py

    r5916 r5958  
    282282     
    283283    def _setFont(self, font): 
    284         dabo.errorLog.write("_setFont not implemented yet.") 
     284        dabo.log.error("_setFont not implemented yet.") 
    285285 
    286286         
     
    291291        return "Not implemented yet." 
    292292    def _setFontBold(self, fontBold): 
    293         dabo.errorLog.write("_setFontBold not implemented yet.") 
     293        dabo.log.error("_setFontBold not implemented yet.") 
    294294 
    295295    def _getFontItalic(self): 
    296296        return "Not implemented yet." 
    297297    def _setFontItalic(self, fontItalic): 
    298         dabo.errorLog.write("_setFontItalic not implemented yet.") 
     298        dabo.log.error("_setFontItalic not implemented yet.") 
    299299 
    300300    def _getFontFace(self): 
     
    304304        return "Not implemented yet." 
    305305    def _setFontSize(self, fontSize): 
    306         dabo.errorLog.write("_setFontSize not implemented yet.") 
     306        dabo.log.error("_setFontSize not implemented yet.") 
    307307 
    308308    def _getFontUnderline(self): 
    309309        return "Not implemented yet." 
    310310    def _setFontUnderline(self, val): 
    311         dabo.errorLog.write("_setFontUnderline not implemented yet.") 
     311        dabo.log.error("_setFontUnderline not implemented yet.") 
    312312 
    313313 
  • trunk/dabo/ui/uitk/uiApp.py

    r3199 r5958  
    8080 
    8181    def onEditPreferences(self, evt): 
    82         dabo.infoLog.write("Stub: uiApp.onEditPreferences()") 
     82        dabo.log.info("Stub: uiApp.onEditPreferences()") 
    8383 
    8484 
     
    135135#               value = None 
    136136#           if type(value) not in (type(str()), type(unicode())): 
    137 #               dabo.errorLog.write("Active control isn't text-based.") 
     137#               dabo.log.error("Active control isn't text-based.") 
    138138#               return 
    139139#  
     
    169169#               win.ShowPosition(win.GetSelection()[1]) 
    170170#           else: 
    171 #               dabo.infoLog.write("Not found") 
     171#               dabo.log.info("Not found") 
    172172 
    173173 
  • trunk/dabo/ui/uiwx/__init__.py

    r5918 r5958  
    296296        wx.CallAfter(fnc, obj, val) 
    297297    except StandardError, e: 
    298         dabo.errorLog.write(_("setAfter() failed to set property '%(prop)s' to value '%(val)s': %(e)s.") 
     298        dabo.log.error(_("setAfter() failed to set property '%(prop)s' to value '%(val)s': %(e)s.") 
    299299                % locals()) 
    300300 
     
    308308        callAfterInterval(interval, fnc, obj, val) 
    309309    except StandardError, e: 
    310         dabo.errorLog.write(_("setAfterInterval() failed to set property '%(prop)s' to value '%(val)s': %(e)s.") 
     310        dabo.log.error(_("setAfterInterval() failed to set property '%(prop)s' to value '%(val)s': %(e)s.") 
    311311                % locals()) 
    312312 
     
    363363            pass 
    364364        else: 
    365             dabo.errorLog.write("Incorrect event class (%s) passed to continueEvent. Error: %s" 
     365            dabo.log.error("Incorrect event class (%s) passed to continueEvent. Error: %s" 
    366366                    % (ustr(evt), ustr(e))) 
    367367 
     
    375375            pass 
    376376        else: 
    377             dabo.errorLog.write("Incorrect event class (%s) passed to continueEvent. Error: %s" 
     377            dabo.log.error("Incorrect event class (%s) passed to continueEvent. Error: %s" 
    378378                    % (ustr(evt), ustr(e))) 
    379379 
     
    936936        mm, dd, yy = dt.month, dt.day, dt.year 
    937937    except AttributeError: 
    938         dabo.errorLog.write(_("Invalid date value passed to getDate(): %s") % dt) 
     938        dabo.log.error(_("Invalid date value passed to getDate(): %s") % dt) 
    939939        return None 
    940940    dlg = wx.lib.calendar.CalenDlg(_getActiveForm(), mm, dd, yy) 
     
    966966        if not isinstance(font, dFont): 
    967967            # This will help identify older code 
    968             dabo.errorLog.write("Invalid font class passed to getFont") 
     968            dabo.log.error("Invalid font class passed to getFont") 
    969969            return None 
    970970        param = font._nativeFont 
     
    11891189            srcFile = utils.resolvePathAndUpdate(srcFile) 
    11901190        except IOError, e: 
    1191             dabo.errorLog.write(_("Class file '%s' not found") % srcFile) 
     1191            dabo.log.error(_("Class file '%s' not found") % srcFile) 
    11921192            raise 
    11931193    return srcFile, isRawXML 
     
    14771477                    return pos 
    14781478        # If we reached here, something's wrong! 
    1479         dabo.errorLog.write(_("Containing sizer did not match item %s") % obj.Name) 
     1479        dabo.log.error(_("Containing sizer did not match item %s") % obj.Name) 
    14801480        return None 
    14811481    elif isinstance(sz, wx.GridBagSizer): 
  • trunk/dabo/ui/uiwx/dDataControlMixin.py

    r5918 r5958  
    8787                except (TypeError, ValueError), e: 
    8888                    nm = self._name 
    89                     dabo.errorLog.write(_("Could not set value of %(nm)s to %(val)s. Error message: %(e)s") 
     89                    dabo.log.error(_("Could not set value of %(nm)s to %(val)s. Error message: %(e)s") 
    9090                            % locals()) 
    9191            self.flushValue() 
  • trunk/dabo/ui/uiwx/dDateTextBox.py

    r5842 r5958  
    233233            else: 
    234234                nm, tv = self.Name, type(val) 
    235                 dabo.errorLog.write(_("Non-date value in %(nm)s: '%(val)s' is type '%(tv)s'") % locals()) 
     235                dabo.log.error(_("Non-date value in %(nm)s: '%(val)s' is type '%(tv)s'") % locals()) 
    236236                return 
    237237        # Default direction 
     
    335335        else: 
    336336            # This shouldn't happen, because onChar would have filtered it out. 
    337             dabo.infoLog.write("Warning in dDateTextBox.adjustDate: %s key sent." % key) 
     337            dabo.log.info("Warning in dDateTextBox.adjustDate: %s key sent." % key) 
    338338            return 
    339339         
  • trunk/dabo/ui/uiwx/dDockForm.py

    r4186 r5958  
    150150                func() 
    151151            else:    
    152                 dabo.errorLog.write(_("Invalid dock position: '%s'.") % side) 
     152                dabo.log.error(_("Invalid dock position: '%s'.") % side) 
    153153        inf.Dock() 
    154154        self._updateAUI() 
     
    236236                self.FloatingBottom = val 
    237237            else: 
    238                 dabo.errorLog.write(_("Cannot set the position of a docked panel")) 
     238                dabo.log.error(_("Cannot set the position of a docked panel")) 
    239239        else: 
    240240            self._properties["Bottom"] = val 
     
    465465                self.FloatingHeight = val 
    466466            else: 
    467                 dabo.errorLog.write(_("Cannot set the Size of a docked panel")) 
     467                dabo.log.error(_("Cannot set the Size of a docked panel")) 
    468468        else: 
    469469            self._properties["Height"] = val 
     
    478478                self.FloatingLeft = val 
    479479            else: 
    480                 dabo.errorLog.write(_("Cannot set the position of a docked panel")) 
     480                dabo.log.error(_("Cannot set the position of a docked panel")) 
    481481        else: 
    482482            self._properties["Left"] = val 
     
    534534                self.FloatingRight = val 
    535535            else: 
    536                 dabo.errorLog.write(_("Cannot set the position of a docked panel")) 
     536                dabo.log.error(_("Cannot set the position of a docked panel")) 
    537537        else: 
    538538            self._properties["Right"] = val 
     
    651651                self.FloatingTop = val 
    652652            else: 
    653                 dabo.errorLog.write(_("Cannot set the position of a docked panel")) 
     653                dabo.log.error(_("Cannot set the position of a docked panel")) 
    654654        else: 
    655655            self._properties["Top"] = val 
     
    686686                self.FloatingWidth = val 
    687687            else: 
    688                 dabo.errorLog.write(_("Cannot set the Size of a docked panel")) 
     688                dabo.log.error(_("Cannot set the Size of a docked panel")) 
    689689        else: 
    690690            self._properties["Width"] = val 
     
    837837        if not ok: 
    838838            # This should never happen; if so, log the error 
    839             dabo.errorLog.write(_("Unmanaged object added to a Dock Form: %s") %evt.child) 
     839            dabo.log.error(_("Unmanaged object added to a Dock Form: %s") %evt.child) 
    840840         
    841841         
  • trunk/dabo/ui/uiwx/dEditor.py

    r5828 r5958  
    227227            if ep < stcEndPos: 
    228228                posdiff = stcEndPos-ep 
    229                 dabo.errorLog.write(_('warning: on page %(page)s: not enough chars rendered, diff: %(posdiff)s') % locals()) 
     229                dabo.log.error(_('warning: on page %(page)s: not enough chars rendered, diff: %(posdiff)s') % locals()) 
    230230        return True 
    231231 
     
    372372        self._printPreview = wx.PrintPreview(po1, po2, self._printData) 
    373373        if not self._printPreview.Ok(): 
    374             dabo.errorLog.write(_("An error occured while preparing preview.")) 
     374            dabo.log.error(_("An error occured while preparing preview.")) 
    375375            return 
    376376        frame = wx.PreviewFrame(self._printPreview, self.Form, _("Print Preview")) 
     
    389389 
    390390        if not printer.Print(self.Form, printout): 
    391             dabo.errorLog.write(_("An error occured while printing.")) 
     391            dabo.log.error(_("An error occured while printing.")) 
    392392        else: 
    393393            self.printData = wx.PrintData(printer.GetPrintDialogData().GetPrintData()) 
     
    845845                    newSize = int(fontSize) 
    846846                except ValueError: 
    847                     dabo.errorLog.write(_("Invalid value passed to changeFontSize: %s") % fontSize) 
     847                    dabo.log.error(_("Invalid value passed to changeFontSize: %s") % fontSize) 
    848848                    return 
    849849        else: 
     
    21432143                    self._language = val.lower() 
    21442144                else: 
    2145                     dabo.errorLog.write(_("Currently only %s are supported") % ", ".join(LexerDic.keys())) 
     2145                    dabo.log.error(_("Currently only %s are supported") % ", ".join(LexerDic.keys())) 
    21462146                self.setDefaults() 
    21472147                self._defaultsSet = True 
     
    24152415                except TypeError, e: 
    24162416                    nm = self._name 
    2417                     dabo.errorLog.write(_("Could not set value of %(nm)s to %(val)s. Error message: %(e)s") 
     2417                    dabo.log.error(_("Could not set value of %(nm)s to %(val)s. Error message: %(e)s") 
    24182418                            % locals()) 
    24192419                self._afterValueChanged() 
  • trunk/dabo/ui/uiwx/dFont.py

    r5918 r5958  
    9090                if not lowVal.startswith("ms shell dlg"): 
    9191                    # Ignore the non-existent MS Shell Dlg font names; they are Windows aliases  
    92                     dabo.errorLog.write(_("The font '%s' doesn't exist on this system.") % val) 
     92                    dabo.log.error(_("The font '%s' doesn't exist on this system.") % val) 
    9393  
    9494        self._propsChanged() 
     
    131131            self._nativeFont.SetPointSize(val) 
    132132        except ValueError: 
    133             dabo.errorLog.write(_("Setting FontSize to %s failed") % val) 
     133            dabo.log.error(_("Setting FontSize to %s failed") % val) 
    134134        self._propsChanged() 
    135135 
  • trunk/dabo/ui/uiwx/dForm.py

    r5955 r5958  
    440440            self.update() 
    441441        except dException.NoRecordsException, e: 
    442             dabo.errorLog.write(_("Cancel failed; no records to cancel.")) 
     442            dabo.log.error(_("Cancel failed; no records to cancel.")) 
    443443        except dException.dException, e: 
    444             dabo.errorLog.write(_("Cancel failed with response: %s") % e) 
     444            dabo.log.error(_("Cancel failed with response: %s") % e) 
    445445            self.notifyUser(ustr(e), title=_("Cancel Not Allowed"), exception=e) 
    446446        self.afterCancel() 
     
    512512 
    513513        except dException.DBQueryException, e: 
    514             dabo.errorLog.write(_("Database Execution failed with response: %s") % e) 
     514            dabo.log.error(_("Database Execution failed with response: %s") % e) 
    515515            self.notifyUser(ustr(e), title=_("Database Action Failed"), severe=True, exception=e) 
    516516            self.StatusText = "" 
    517517 
    518518        except dException.dException, e: 
    519             dabo.errorLog.write(_("Requery failed with response: %s") % e) 
     519            dabo.log.error(_("Requery failed with response: %s") % e) 
    520520            self.notifyUser(ustr(e), title=_("Requery Not Allowed"), severe=True, exception=e) 
    521521            self.StatusText = "" 
     
    565565                sys.exit() 
    566566            except dException.dException, e: 
    567                 dabo.errorLog.write(_("Delete failed with response: %s") % e) 
     567                dabo.log.error(_("Delete failed with response: %s") % e) 
    568568                self.notifyUser(ustr(e), title=_("Deletion Not Allowed"), severe=True, exception=e) 
    569569            self.afterDelete() 
     
    599599                sys.exit() 
    600600            except dException.dException, e: 
    601                 dabo.errorLog.write(_("Delete All failed with response: %s") % e) 
     601                dabo.log.error(_("Delete All failed with response: %s") % e) 
    602602                self.notifyUser(ustr(e), title=_("Deletion Not Allowed"), severe=True, exception=e) 
    603603        self.afterDeleteAll() 
     
    785785            # Now that DataSources are not always bizobjs, just return 
    786786            ## No bizobj for that DataSource; record the error 
    787             #dabo.errorLog.write("No business object found for DataSource: '%s', DataField: '%s' " 
     787            #dabo.log.error("No business object found for DataSource: '%s', DataField: '%s' " 
    788788            #       % (ds, df)) 
    789789            return True 
     
    856856                self.afterSetPrimaryBizobj() 
    857857            else: 
    858                 dabo.infoLog.write(_("bizobj for data source %s does not exist.") % bizOrDataSource) 
     858                dabo.log.info(_("bizobj for data source %s does not exist.") % bizOrDataSource) 
    859859 
    860860 
  • trunk/dabo/ui/uiwx/dFormMixin.py

    r5949 r5958  
    118118                self.Connection = None 
    119119            if self.Connection is None: 
    120                 dabo.infoLog.write(_("Could not establish connection '%s'") % 
     120                dabo.log.info(_("Could not establish connection '%s'") % 
    121121                        self._cxnName) 
    122122        # If code to create bizobjs is present, run it. 
     
    576576            self._objectRegistry[id] = obj 
    577577            if hasattr(self, id) or self.__dict__.has_key(id): 
    578                 dabo.errorLog.write(_("RegID '%s' conflicts with existing name") % id) 
     578                dabo.log.error(_("RegID '%s' conflicts with existing name") % id) 
    579579            else: 
    580580                self.__dict__[id] = obj 
  • trunk/dabo/ui/uiwx/dGlWindow.py

    r3672 r5958  
    2121except StandardError, e: 
    2222    # Report the error, and abandon the import 
    23     dabo.errorLog.write(_("Error importing OpenGL: %s") % e) 
     23    dabo.log.error(_("Error importing OpenGL: %s") % e) 
    2424    openGL = False 
    2525     
  • trunk/dabo/ui/uiwx/dGrid.py

    r5956 r5958  
    6565#           # I'd like to know when kind isn't 0, to make sure I've covered all the 
    6666#           # bases. Well okay, it's really because I'm just curious. 
    67 #           dabo.infoLog.write("dGrid.Table.GetAttr:: kind is not 0, it is %s." % kind) 
     67#           dabo.log.info("dGrid.Table.GetAttr:: kind is not 0, it is %s." % kind) 
    6868 
    6969        ## The column attr object is maintained in dColumn: 
     
    151151                    except IndexError: 
    152152                        # Something's odd. Print an error message and move on. 
    153                         dabo.errorLog.write("Unknown data type found in setColumns(): %s" 
     153                        dabo.log.error("Unknown data type found in setColumns(): %s" 
    154154                                % col.DataType) 
    155155                        col.DataType = ustr(col.DataType) 
     
    350350class GridListEditor(wx.grid.GridCellChoiceEditor): 
    351351    def __init__(self, *args, **kwargs): 
    352         dabo.infoLog.write("GridListEditor: Init ") 
    353         dabo.infoLog.write(ustr(args)) 
    354         dabo.infoLog.write(ustr(kwargs)) 
     352        dabo.log.info("GridListEditor: Init ") 
     353        dabo.log.info(ustr(args)) 
     354        dabo.log.info(ustr(kwargs)) 
    355355        super(GridListEditor, self).__init__(*args, **kwargs) 
    356356 
    357357 
    358358    def Create(self, parent, id, evtHandler, *args, **kwargs): 
    359         dabo.infoLog.write("GridListEditor: Create") 
    360         dabo.infoLog.write(ustr(args)) 
    361         dabo.infoLog.write(ustr(kwargs)) 
     359        dabo.log.info("GridListEditor: Create") 
     360        dabo.log.info(ustr(args)) 
     361        dabo.log.info(ustr(kwargs)) 
    362362        self.control = dabo.ui.dDropdownList(parent=parent, id=id, 
    363363                ValueMode="String") 
     
    373373 
    374374    def SetParameters(self, paramStr): 
    375         dabo.infoLog.write("GridListEditor: SetParameters: %s" % paramStr) 
     375        dabo.log.info("GridListEditor: SetParameters: %s" % paramStr) 
    376376        self.control.Choices = eval(paramStr) 
    377377 
    378378 
    379379    def BeginEdit(self, row, col, grid): 
    380         dabo.infoLog.write("GridListEditor: BeginEdit (%d,%d)" % (row, col)) 
     380        dabo.log.info("GridListEditor: BeginEdit (%d,%d)" % (row, col)) 
    381381        self.value = grid.GetTable().GetValue(row, col) 
    382         dabo.infoLog.write("GridListEditor: Value=%s" % self.value) 
    383         dabo.infoLog.write("GridListEditor: Choices=%s" % self.control.Choices) 
     382        dabo.log.info("GridListEditor: Value=%s" % self.value) 
     383        dabo.log.info("GridListEditor: Choices=%s" % self.control.Choices) 
    384384        try: 
    385385            self.control.Value = self.value 
    386386        except ValueError: 
    387             dabo.infoLog.write("GridListEditor: Value not in Choices") 
     387            dabo.log.info("GridListEditor: Value not in Choices") 
    388388        self.control.SetFocus() 
    389389 
    390390 
    391391    def EndEdit(self, row, col, grid): 
    392         dabo.infoLog.write("GridListEditor: EndEdit (%d,%d)" % (row, col)) 
     392        dabo.log.info("GridListEditor: EndEdit (%d,%d)" % (row, col)) 
    393393        changed = False 
    394394        v = self.control.Value 
     
    403403 
    404404    def Reset(self): 
    405         dabo.infoLog.write("GridListEditor: Reset") 
     405        dabo.log.info("GridListEditor: Reset") 
    406406        self.control.Value = self.value 
    407407 
    408408#   def SetSize(self, rectorig): 
    409 #       dabo.infoLog.write("GridListEditor: SetSize: %s" % rectorig) 
    410 #       dabo.infoLog.write("GridListEditor: type of rectorig: %s" % type(rectorig)) 
     409#       dabo.log.info("GridListEditor: SetSize: %s" % rectorig) 
     410#       dabo.log.info("GridListEditor: type of rectorig: %s" % type(rectorig)) 
    411411# #         rect = wx.Rect(rectorig) 
    412 # #         dabo.infoLog.write("GridListEditor RECT: %s" % rect) 
     412# #         dabo.log.info("GridListEditor RECT: %s" % rect) 
    413413#       super(GridListEditor, self).SetSize(rectorig) 
    414414 
    415415    def IsAcceptedKey(self, key): 
    416         dabo.infoLog.write("GridListEditor: check key: %d" % (key)) 
     416        dabo.log.info("GridListEditor: check key: %d" % (key)) 
    417417        return true 
    418418 
     
    19951995                self.DataSet[row][fld] = val 
    19961996        except StandardError, e: 
    1997             dabo.errorLog.write("Cannot update data set: %s" % e) 
     1997            dabo.log.error("Cannot update data set: %s" % e) 
    19981998 
    19991999 
     
    20502050            pyType = biz.getDataTypeForField(df) 
    20512051        except ValueError, e: 
    2052             dabo.errorLog.write(e) 
     2052            dabo.log.error(e) 
    20532053            return None 
    20542054        return pyType 
     
    26012601                col = self.Columns[col] 
    26022602            else: 
    2603                 dabo.errorLog.write(_("Invalid column number passed to 'showColumn()'.")) 
     2603                dabo.log.error(_("Invalid column number passed to 'showColumn()'.")) 
    26042604                return 
    26052605        col._visible = visible 
     
    30223022                    ret = True 
    30233023                else: 
    3024                     dabo.errorLog.write(_("Invalid boolean replacement value: %s") % replaceString) 
     3024                    dabo.log.error(_("Invalid boolean replacement value: %s") % replaceString) 
    30253025                    ret = False 
    30263026            else: 
     
    30353035                        ret = True 
    30363036                    except errors: 
    3037                         dabo.errorLog.write(_("Invalid replacement value: %s") % replaceString) 
     3037                        dabo.log.error(_("Invalid replacement value: %s") % replaceString) 
    30383038                        ret = False 
    30393039            if ret: 
     
    31313131            if not inBatch: 
    31323132                # For now, just log it 
    3133                 dabo.infoLog.write(_("Cannot set width of column %s") % col.Order) 
     3133                dabo.log.info(_("Cannot set width of column %s") % col.Order) 
    31343134        return col 
    31353135 
  • trunk/dabo/ui/uiwx/dGridSizer.py

    r5941 r5958  
    380380        if rowspan > 1: 
    381381            if not self._clearCells(obj, rowspan, "row"): 
    382                 dabo.errorLog.write("Cannot set RowSpan for %s; remove objects in the way first." % itm.Name) 
     382                dabo.log.error("Cannot set RowSpan for %s; remove objects in the way first." % itm.Name) 
    383383                return 
    384384        self.setGridSpan(obj, row=rowspan) 
     
    389389        if colspan > 1: 
    390390            if not self._clearCells(obj, colspan, "col"): 
    391                 dabo.errorLog.write("Cannot set ColSpan for %s; remove objects in the way first." % itm.Name) 
     391                dabo.log.error("Cannot set ColSpan for %s; remove objects in the way first." % itm.Name) 
    392392                return 
    393393        self.setGridSpan(obj, col=colspan) 
  • trunk/dabo/ui/uiwx/dImage.py

    r5841 r5958  
    228228                maxIdx = self.FrameCount - 1 
    229229                if idx > maxIdx: 
    230                     dabo.errorLog.write(_("Attempt to set PictureIndex (%(idx)s)to a value greater than the maximum index available (%(maxIdx)s).") % locals()) 
     230                    dabo.log.error(_("Attempt to set PictureIndex (%(idx)s)to a value greater than the maximum index available (%(maxIdx)s).") % locals()) 
    231231                    idx = self.PictureIndex = maxIdx 
    232232            try: 
     
    269269            self._showPic() 
    270270        except KeyError: 
    271             dabo.errorLog.write(_("ScaleMode must be either 'Clip', 'Proportional' or 'Stretch'.") ) 
     271            dabo.log.error(_("ScaleMode must be either 'Clip', 'Proportional' or 'Stretch'.") ) 
    272272 
    273273 
  • trunk/dabo/ui/uiwx/dLinePlot.py

    r5919 r5958  
    99except StandardError, e: 
    1010    # Report the error, and abandon the import 
    11     dabo.errorLog.write(_("Error importing numpy.oldnumeric: %s") % e) 
     11    dabo.log.error(_("Error importing numpy.oldnumeric: %s") % e) 
    1212    _Numeric = False 
    1313 
  • trunk/dabo/ui/uiwx/dListControl.py

    r5953 r5958  
    112112            self.SetItemState(row, wx.LIST_STATE_SELECTED, wx.LIST_STATE_SELECTED) 
    113113        else: 
    114             dabo.errorLog.write("An attempt was made to select a non-existent row") 
     114            dabo.log.error("An attempt was made to select a non-existent row") 
    115115 
    116116 
     
    139139                self.select(row) 
    140140        else: 
    141             dabo.errorLog.write("'selectAll()' may only be called on List Controls that designated as MultipleSelect") 
     141            dabo.log.error("'selectAll()' may only be called on List Controls that designated as MultipleSelect") 
    142142 
    143143 
     
    255255            self._restoreRowSelection(row) 
    256256        else: 
    257             dabo.errorLog.write("An attempt was made to remove a non-existent row") 
     257            dabo.log.error("An attempt was made to remove a non-existent row") 
    258258 
    259259 
  • trunk/dabo/ui/uiwx/dMaskedTextBox.py

    r5304 r5958  
    113113                self._format = val 
    114114            except AttributeError: 
    115                 dabo.errorLog.write(_("Invalid Format value: %s") % val) 
     115                dabo.log.error(_("Invalid Format value: %s") % val) 
    116116        else: 
    117117            self._properties["Format"] = val 
     
    125125            if self.GetAutoformat() and val: 
    126126                # Cannot have both a mask and a format 
    127                 dabo.errorLog.write(_("Cannot set InputCodes when a Format has been set")) 
     127                dabo.log.error(_("Cannot set InputCodes when a Format has been set")) 
    128128            elif [cd for cd in val if cd not in self._allowedInputCodes]: 
    129129                # Illegal codes 
    130130                bad = "".join([cd for cd in val if cd not in self._allowedInputCodes]) 
    131                 dabo.errorLog.write(_("Invalid InputCodes: %s") % bad)                 
     131                dabo.log.error(_("Invalid InputCodes: %s") % bad)              
    132132            else: 
    133133                val = self._uniqueCodes(val) 
     
    145145            if self.GetAutoformat() and val: 
    146146                # Cannot have both a mask and a format 
    147                 dabo.errorLog.write(_("Cannot set a Mask when a Format has been set")) 
     147                dabo.log.error(_("Cannot set a Mask when a Format has been set")) 
    148148            else: 
    149149                self._mask = val 
  • trunk/dabo/ui/uiwx/dPageFrame.py

    r5919 r5958  
    133133                # Changed this to write to the info log to avoid error messages that 
    134134                #  unnecessarily exaggerate the problem. 
    135                 dabo.infoLog.write(_("ListSpacing is not supported in wxPython %s") % wx.__version__) 
     135                dabo.log.info(_("ListSpacing is not supported in wxPython %s") % wx.__version__) 
    136136        else: 
    137137            self._properties["ListSpacing"] = val 
  • trunk/dabo/ui/uiwx/dPemMixin.py

    r5934 r5958  
    457457                # Log it and continue 
    458458                nm = self.Name 
    459                 dabo.errorLog.write(_("Empty Event Binding: Object: %(nm)s; Event: %(evt)s") % locals()) 
     459                dabo.log.error(_("Empty Event Binding: Object: %(nm)s; Event: %(evt)s") % locals()) 
    460460                continue 
    461461            try: 
    462462                mthd = eval(mthdString) 
    463463            except (AttributeError, NameError), e: 
    464                 dabo.errorLog.write(_("Could not evaluate method '%(mthdString)s': %(e)s") % locals()) 
     464                dabo.log.error(_("Could not evaluate method '%(mthdString)s': %(e)s") % locals()) 
    465465                continue 
    466466            self.bindEvent(evt, mthd) 
     
    878878            # Too many 'unlockDisplay' calls to the same object were made. Log 
    879879            # the mistake, but don't throw a Python error. 
    880             dabo.errorLog.write(_("Extra call to unlockDisplay() for object %s") % self) 
     880            dabo.log.error(_("Extra call to unlockDisplay() for object %s") % self) 
    881881 
    882882 
     
    899899                    # since it is most likely deleted, but the presence of these messages 
    900900                    # will ensure that possible problems will not be silenced. 
    901                     dabo.errorLog.write(_("Failed to unlock display: %s") % e) 
     901                    dabo.log.error(_("Failed to unlock display: %s") % e) 
    902902            release = __del__ 
    903903        return DisplayLocker(self) 
     
    20092009                self.SetFont(val._nativeFont) 
    20102010            except AttributeError: 
    2011                 dabo.errorLog.write(_("Error setting font for %s") % self.Name) 
     2011                dabo.log.error(_("Error setting font for %s") % self.Name) 
    20122012            val.bindEvent(dabo.dEvents.FontPropertiesChanged, self._onFontPropsChanged) 
    20132013        else: 
     
    22492249                            crsName = eval("uic.%s%s" % (prfx, valTitle)) 
    22502250                        except AttributeError: 
    2251                             dabo.errorLog.write(_("Invalid MousePointer value: '%s'") % val) 
     2251                            dabo.log.error(_("Invalid MousePointer value: '%s'") % val) 
    22522252                            return 
    22532253                crs = uic.getStockCursor(crsName) 
     
    24192419        except KeyError: 
    24202420            err = _("Attempt in object '%(self)s' to set duplicate RegID: '%(val)s'") % locals() 
    2421             dabo.errorLog.write(err) 
     2421            dabo.log.error(err) 
    24222422            raise KeyError(err) 
    24232423             
     
    25722572            return self.IsShown() 
    25732573        except AttributeError: 
    2574             dabo.errorLog.write(_("The object %s does not support the Visible property.") % self) 
     2574            dabo.log.error(_("The object %s does not support the Visible property.") % self) 
    25752575            return None 
    25762576     
     
    25802580                self.Show(bool(val)) 
    25812581            except AttributeError: 
    2582                 dabo.errorLog.write(_("The object %s does not support the Visible property.") % self) 
     2582                dabo.log.error(_("The object %s does not support the Visible property.") % self) 
    25832583        else: 
    25842584            self._properties["Visible"] = val 
  • trunk/dabo/ui/uiwx/dRadioList.py

    r5860 r5958  
    248248            self._items[idx].Enabled = val 
    249249        except IndexError: 
    250             dabo.errorLog.write(_("Could not find a button with Caption of '%s'") % itm) 
     250            dabo.log.error(_("Could not find a button with Caption of '%s'") % itm) 
    251251         
    252252 
  • trunk/dabo/ui/uiwx/dRichTextBox.py

    r5923 r5958  
    6666                handler = self._xmlHandler 
    6767                filename = "%s.xml" % filename 
    68                 dabo.infoLog.write(_("Forcing to RichText XML format")) 
     68                dabo.log.info(_("Forcing to RichText XML format")) 
    6969            handler.SaveFile(self.GetBuffer(), filename) 
    7070 
  • trunk/dabo/ui/uiwx/dSizerMixin.py

    r5906 r5958  
    303303                        return pos 
    304304            # If we reached here, something's wrong! 
    305             dabo.errorLog.write(_("Containing sizer did not match item %s") % self.Name) 
     305            dabo.log.error(_("Containing sizer did not match item %s") % self.Name) 
    306306            return None 
    307307        elif isinstance(sz, wx.GridBagSizer): 
  • trunk/dabo/ui/uiwx/dSlidePanelControl.py

    r5896 r5958  
    195195        if val.lower().strip() not in self._barStylesLow: 
    196196            bs = ", ".join(self._barStyles) 
    197             dabo.errorLog.write(_("Unknown BarStyle passed: %(val)s. BarStyle must be one of: %(bs)s") 
     197            dabo.log.error(_("Unknown BarStyle passed: %(val)s. BarStyle must be one of: %(bs)s") 
    198198                    % locals()) 
    199199        else: 
  • trunk/dabo/ui/uiwx/dSlider.py

    r5780 r5958  
    110110        isHoriz = (val.lower()[:1] == "h") 
    111111        if isHoriz and tickpos in ("Left", "Right"): 
    112             dabo.errorLog.write(_("Cannot set the slider to Horizontal when TickPosition is %s.") % tickpos) 
     112            dabo.log.error(_("Cannot set the slider to Horizontal when TickPosition is %s.") % tickpos) 
    113113        elif not isHoriz and tickpos in ("Top", "Bottom"): 
    114             dabo.errorLog.write(_("Cannot set the slider to Vertical when TickPosition is %s.") % tickpos) 
     114            dabo.log.error(_("Cannot set the slider to Vertical when TickPosition is %s.") % tickpos) 
    115115        self._delWindowStyleFlag(wx.SL_HORIZONTAL) 
    116116        self._delWindowStyleFlag(wx.SL_VERTICAL) 
  • trunk/dabo/ui/uiwx/dSpinner.py

    r5919 r5958  
    351351                numVal = self._numericStringVal(val) 
    352352                if numVal is None: 
    353                     dabo.errorLog.write(_("Spinner values must be numeric. Invalid:'%s'") % val) 
     353                    dabo.log.error(_("Spinner values must be numeric. Invalid:'%s'") % val) 
    354354                else: 
    355355                    self._proxy_textbox.Value = val 
  • trunk/dabo/ui/uiwx/dTextBoxMixin.py

    r5919 r5958  
    719719                    #PVG: maskedtextedit sometimes fails, on value error..allow the code to continue 
    720720                    uStrVal = self.Application.str2Unicode(strVal) 
    721                     dabo.errorLog.write(_("Error setting value to '%(uStrVal)s: %(e)s") % locals()) 
     721                    dabo.log.error(_("Error setting value to '%(uStrVal)s: %(e)s") % locals()) 
    722722 
    723723            if type(_oldVal) != type(val) or _oldVal != val: 
  • trunk/dabo/ui/uiwx/uiApp.py

    r5942 r5958  
    135135        elif wx.PlatformInfo[0] == "__WXMSW__": 
    136136            self._platform = _("Win") 
    137         dabo.infoLog.write(txt) 
     137        dabo.log.info(txt) 
    138138        self.Bind(wx.EVT_ACTIVATE_APP, self._onWxActivate) 
    139139        self.Bind(wx.EVT_KEY_DOWN, self._onWxKeyDown) 
     
    289289                    success = self.dApp._updateFramework() 
    290290                except IOError, e: 
    291                     dabo.errorLog.write(_("Cannot update files; Error: %s") % e) 
     291                    dabo.log.error(_("Cannot update files; Error: %s") % e) 
    292292                    dabo.ui.info(_("You do not have permission to update the necessary files. " 
    293293                            "Please re-run the app with administrator privileges."), title=_("Permission Denied")) 
     
    771771                    pass 
    772772            else: 
    773                 dabo.infoLog.write(_("Stub: dApp.onEditPreferences()")) 
     773                dabo.log.info(_("Stub: dApp.onEditPreferences()")) 
    774774 
    775775 
     
    782782                    win.Undo() 
    783783                except AttributeError: 
    784                     dabo.errorLog.write(_("No apparent way to undo.")) 
     784                    dabo.log.error(_("No apparent way to undo.")) 
    785785     
    786786 
     
    793793                    win.Redo() 
    794794                except AttributeError: 
    795                     dabo.errorLog.write(_("No apparent way to redo.")) 
     795                    dabo.log.error(_("No apparent way to redo.")) 
    796796 
    797797 
     
    10101010                    value = None 
    10111011                if not isinstance(value, basestring): 
    1012                     dabo.errorLog.write(_("Active control isn't text-based.")) 
     1012                    dabo.log.error(_("Active control isn't text-based.")) 
    10131013                    return 
    10141014 
     
    10451045                    win.ShowPosition(win.GetSelection()[1]) 
    10461046                else: 
    1047                     dabo.infoLog.write(_("Not found")) 
     1047                    dabo.log.info(_("Not found")) 
    10481048                return ret 
    10491049                 
     
    11431143            pth = frm._sourceFilePath 
    11441144        except AttributeError: 
    1145             dabo.errorLog.write(_("Only .cdxml forms can be re-loaded")) 
     1145            dabo.log.error(_("Only .cdxml forms can be re-loaded")) 
    11461146            return 
    11471147        self.dApp.resyncFiles()