本文整理汇总了Python中Acspy.Common.Log.startPeriodicFlush方法的典型用法代码示例。如果您正苦于以下问题:Python Log.startPeriodicFlush方法的具体用法?Python Log.startPeriodicFlush怎么用?Python Log.startPeriodicFlush使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Acspy.Common.Log
的用法示例。
在下文中一共展示了Log.startPeriodicFlush方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testSetFlushInterval
# 需要导入模块: from Acspy.Common import Log [as 别名]
# 或者: from Acspy.Common.Log import startPeriodicFlush [as 别名]
def testSetFlushInterval(self):
"""PeriodicFlushCheck updates flush interval correctly"""
Log.startPeriodicFlush()
now = time.time()
next = Log.NEXTEVENT
Log.setFlushInterval(5)
self.assertNotEqual(next, Log.NEXTEVENT)
self.assertAlmostEqual(now + Log.INTERVAL, Log.NEXTEVENT[0],1)
Log.stopPeriodicFlush()
示例2: testCycleStartStop
# 需要导入模块: from Acspy.Common import Log [as 别名]
# 或者: from Acspy.Common.Log import startPeriodicFlush [as 别名]
def testCycleStartStop(self):
"""PeriodicFlushCheck flushing thread start and stops correctly."""
Log.startPeriodicFlush()
self.assertEqual(Log.DEFAULT_FLUSH_PERIOD, Log.INTERVAL)
self.assertEqual(True, isinstance(Log.SCHEDULER, sched.scheduler))
self.assertEqual(True, isinstance(Log.FLUSHTHREAD, threading.Thread))
self.assertEqual(True, Log.FLUSHTHREAD.isAlive())
self.assertEqual(False, Log.NEXTEVENT is None)
Log.stopPeriodicFlush()
self.assertEqual(False, Log.FLUSHTHREAD.isAlive())
示例3: testDoubleStart
# 需要导入模块: from Acspy.Common import Log [as 别名]
# 或者: from Acspy.Common.Log import startPeriodicFlush [as 别名]
def testDoubleStart(self):
"""PeriodicFlushCheck only one thread is created if start is called twice."""
Log.startPeriodicFlush()
ft = Log.FLUSHTHREAD
sc = Log.SCHEDULER
ne = Log.NEXTEVENT
Log.startPeriodicFlush()
self.assertEqual(ft, Log.FLUSHTHREAD)
self.assertEqual(sc, Log.SCHEDULER)
self.assertEqual(ne, Log.NEXTEVENT)
Log.stopPeriodicFlush()
示例4: testSetFlushIntervalInvalid
# 需要导入模块: from Acspy.Common import Log [as 别名]
# 或者: from Acspy.Common.Log import startPeriodicFlush [as 别名]
def testSetFlushIntervalInvalid(self):
"""PeriodicFlushCheck flush thread stopped when invalid interval is set"""
Log.startPeriodicFlush()
Log.setFlushInterval(-5)
self.assertEqual(False, Log.FLUSHTHREAD.isAlive())
Log.stopPeriodicFlush()
示例5: refresh_logging_config
# 需要导入模块: from Acspy.Common import Log [as 别名]
# 或者: from Acspy.Common.Log import startPeriodicFlush [as 别名]
def refresh_logging_config(self):
'''
Reset the logging configuration to the original CDB settings.
Returns: Nothing
Raises: Nothing
'''
# Default values from the XML Schema
lcfg = LoggingConfig_xsd.LoggingConfig()
centrallevel = lcfg.minLogLevel
locallevel = lcfg.minLogLevelLocal
cap = lcfg.maxLogQueueSize
batch = lcfg.dispatchPacketSize
displevel = lcfg.immediateDispatchLevel
flush = lcfg.flushPeriodSeconds
# Retrieve the CDB information
try:
logconfig = self.cdbAccess.getElement("MACI/Containers/" + self.name + "/LoggingConfig", "LoggingConfig")
try:
centrallevel = int(logconfig[0]['minLogLevel'])
except:
# Default value used because CDB has no setting for this attribute
pass
try:
locallevel = int(logconfig[0]['minLogLevelLocal'])
except:
# Default value used because CDB has no setting for this attribute
pass
try:
cap = int(logconfig[0]['maxLogQueueSize'])
except:
# Default value used because CDB has no setting for this attribute
pass
try:
batch = int(logconfig[0]['dispatchPacketSize'])
except:
# Default value used because CDB has no setting for this attribute
pass
try:
displevel = int(logconfig[0]['immediateDispatchLevel'])
except:
# Default value used because CDB has no setting for this attribute
pass
try:
flush = int(logconfig[0]['flushPeriodSeconds'])
except:
# Default value used because CDB has no setting for this attribute
pass
# Refresh all named loggers from the CDB as well.
for log in self.get_logger_names():
self.configureComponentLogger(log)
except:
# No logging configuration given in the CDB so defaults are used.
pass
# Environment variable takes precedence over the CDB value
if 'ACS_LOG_CENTRAL' in environ:
centrallevel = int(environ['ACS_LOG_CENTRAL'])
if 'ACS_LOG_STDOUT' in environ:
locallevel = int(environ['ACS_LOG_STDOUT'])
Log.setDefaultLevels(maci.LoggingConfigurable.LogLevels(False, centrallevel, locallevel))
Log.setCapacity(cap)
Log.setBatchSize(batch)
Log.setImmediateDispatchLevel(displevel)
# No need to create another flush thread when one already exists.
if Log.isFlushRunning():
Log.setFlushInterval(flush)
else:
Log.startPeriodicFlush(flush)