本文整理汇总了Python中Acspy.Common.Log.setBatchSize方法的典型用法代码示例。如果您正苦于以下问题:Python Log.setBatchSize方法的具体用法?Python Log.setBatchSize怎么用?Python Log.setBatchSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Acspy.Common.Log
的用法示例。
在下文中一共展示了Log.setBatchSize方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testBatchSizeExceedCapacity
# 需要导入模块: from Acspy.Common import Log [as 别名]
# 或者: from Acspy.Common.Log import setBatchSize [as 别名]
def testBatchSizeExceedCapacity(self):
"""Log handles batch size greater than capacity correctly"""
self.assertEqual(True, Log.CENTRALHANDLER.capacity >= Log.CENTRALHANDLER.batchsize)
Log.setBatchSize(Log.CENTRALHANDLER.capacity + 2)
self.assertEqual(Log.CENTRALHANDLER.capacity, Log.CENTRALHANDLER.batchsize)
示例2: testInvalidBatchSize
# 需要导入模块: from Acspy.Common import Log [as 别名]
# 或者: from Acspy.Common.Log import setBatchSize [as 别名]
def testInvalidBatchSize(self):
"""Log handles invalid batch size correctly"""
self.assertEqual(10, Log.CENTRALHANDLER.batchsize)
Log.setBatchSize(-2)
self.assertEqual(0, Log.CENTRALHANDLER.batchsize)
示例3: testBatchSize
# 需要导入模块: from Acspy.Common import Log [as 别名]
# 或者: from Acspy.Common.Log import setBatchSize [as 别名]
def testBatchSize(self):
"""Log changes log batch size correctly"""
self.assertEqual(10, Log.CENTRALHANDLER.batchsize)
self.assertEqual(1000, Log.CENTRALHANDLER.capacity)
Log.setBatchSize(15)
self.assertEqual(15, Log.CENTRALHANDLER.batchsize)
示例4: tearDown
# 需要导入模块: from Acspy.Common import Log [as 别名]
# 或者: from Acspy.Common.Log import setBatchSize [as 别名]
def tearDown(self):
pass
Log.setBatchSize(10)
示例5: setUp
# 需要导入模块: from Acspy.Common import Log [as 别名]
# 或者: from Acspy.Common.Log import setBatchSize [as 别名]
def setUp(self):
self.mylogger = Log.Logger("mylogger")
Log.setBatchSize(0)
示例6: refresh_logging_config
# 需要导入模块: from Acspy.Common import Log [as 别名]
# 或者: from Acspy.Common.Log import setBatchSize [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)