def saveLoggingContext(self, logcfg_url, oldstyle_loglevel, rscCtx ):
# apply resource context to macro definitions
if rscCtx:
rscCtx.apply(self.loggingMacros )
self.loggingCtx = rscCtx
# test we have a logging URLx
self.loggingURL = logcfg_url
if logcfg_url==None or logcfg_url=="" :
self.logConfig = ossie.logger.GetDefaultConfig()
else:
# try to process URL and grab contents
try:
cfg_data=ossie.logger.GetConfigFileContents( logcfg_url )
if cfg_data and len(cfg_data) > 0 :
self.logConfig = ossie.logger.ExpandMacros( cfg_data, self.loggingMacros )
except:
pass
# apply logging level if explicitly stated
if oldstyle_loglevel != None and oldstyle_loglevel > -1 :
loglevel = ossie.logger.ConvertLogLevel(oldstyle_loglevel)
self.setLogLevel( "", loglevel )
if self._log and self._log.getEffectiveLevel() == logging.NOTSET:
self.setLevel( self._logid, loglevel )
else:
if self._log and self._log.getEffectiveLevel() == logging.NOTSET:
loglevel = ossie.logger.ConvertLog4ToCFLevel( logging.getLogger(None).getEffectiveLevel() )
self.setLogLevel( self._logid, loglevel )
# assign an event channel manager to the logging library
ossie.logger.SetEventChannelManager( self._ecm )
评论列表
文章目录