本文整理汇总了Python中org.apache.log4j.Logger类的典型用法代码示例。如果您正苦于以下问题:Python Logger类的具体用法?Python Logger怎么用?Python Logger使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Logger类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run_command_plugins
def run_command_plugins(plugin_point):
if site_home:
sys.path.append(site_home + '/custom/plugins')
else:
sys.path.append('custom/plugins')
# run any global plugin for this command
script_name = command_name + '_' + plugin_point + '.py'
script_file = os.path.join(site_home, 'custom/plugins', script_name)
if os.path.isfile(script_file):
main_logger.info('running global ' + plugin_point + ' command plugin: ' + script_file)
call_extension(script_file, Logger.getLogger(plugin_point + '_plugin'))
# run any configured plugins for this command
if rb_config is not None:
plugins_list = rb_config.getProperty('plugins.' + command_name + '.' + plugin_point)
if plugins_list is not None:
for plugin in plugins_list.split(','):
script_file = os.path.join(site_home, 'custom/plugins', plugin)
if os.path.isfile(script_file):
main_logger.info('Running configured ' + plugin_point + ' command plugin: ' + script_file)
call_extension(script_file, Logger.getLogger('plugin'))
else:
build_file=find_command_build_file(os.path.join(site_home, 'custom/commands/ant'),plugin)
if build_file:
run_ant_target(build_file, plugin)
else:
main_logger.warn('Configured ' + plugin_point + ' command plugin script not found: ' + script_file)
示例2: __init__
def __init__(self):
"""
Initialize tests
"""
Logger.getLogger("net.spy.memcached").setLevel(Level.DEBUG);
self.clients = []
if USE_GLOBAL_CLIENT:
# use global client
self.client = global_client
else:
cfb = ConnectionFactoryBuilder()
self.client = ArcusClient.createArcusClient(arcus_cloud, service_code, cfb)
print 'Wait for per-thread client to be connected to Arcus cloud (%d seconds)' % DEFAULT_CONNECTION_WAIT
Thread.currentThread().sleep(DEFAULT_CONNECTION_WAIT * 1000)
self.flush_counter = 0
self.tests = []
# insert operations
self.tests.append(Test(1, "KeyValue").wrap(self.KeyValue))
self.tests.append(Test(2, "Collection_Btree").wrap(self.Collection_Btree))
self.tests.append(Test(3, "Collection_Set").wrap(self.Collection_Set))
self.tests.append(Test(4, "Collection_List").wrap(self.Collection_List))
示例3: deleteCustomer
def deleteCustomer(mc):
print 'Checking for existing test customer...'
cm = mc.getCustomerManager()
cust = cm.findCustomers([SearchConstraint(ICustomerManager.PROP_DOMAINS, SearchConstraintOperator.CONSTRAINT_LIKE_INSENSITIVE, '%enron.com%')])
if cust is not None and len( cust ) == 1:
testCust = cust[0]
Logger.getLogger( "cloud.py" ).info( "Customer with domain enron.com already existed, did a test not clean up? Deleting customer..." )
print 'Deleting customer systest_journaling_customer...'
cm.deleteCustomers([testCust.getCustID()]);
return
示例4: __init__
def __init__(self, queueSize):
self.logger = Logger.getLogger("wtGundamWarriorController")
# self.logger.setLevel(Level.DEBUG)
self.queueSize = queueSize
self.wq = wtWorkQueue(queueSize)
self.workItemsCreated = 0;
示例5: testWorkers_Interrupt
def testWorkers_Interrupt(self):
self.logger = Logger.getLogger("TestWorkerThreadController")
# self.logger.setLevel(Level.DEBUG)
wc = MyWorkerController()
# True: Create Conditional to test Interrupt.
wc.createWorkers(MyWorker, 50, True)
wc.startWorkers()
# Check running state of threads.
for t in wc.loopers:
self.assert_(t.isAlive() == True)
# Check initial state of validation variables.
for t in wc.loopers:
self.assert_(t.stopProc == False)
self.assert_(t.wasStopped == False)
self.assert_(t.wasInterrupted == False)
self.logger.debug("=====> Sleeping...")
time.sleep(3)
wc.stopWorkersViaInterrupt()
# Give threads some time to quiesce.
time.sleep(1)
# Check that all threads were stopped via sopProc flag.
for t in wc.loopers:
self.assert_(t.isAlive() == False)
# Check that all threads are not in a running state.
for t in wc.loopers:
self.assert_(t.stopProc == False)
self.assert_(t.wasStopped == False)
self.assert_(t.wasInterrupted == True)
示例6: __init__
def __init__(self, name, conf, admin):
self.logger = Logger.getLogger("HBaseTable")
# self.logger.setLevel(Level.DEBUG)
self.conf = conf
self.admin = admin
self.name = name
self._table = None
示例7: setupCustomer
def setupCustomer(mc,island,domain,isCloud,isOnPremises,userAccounts,loadCorpus=False):
deleteCustomer(mc)
amptool = ActiveMailboxPartitionTool()
emscmdtool = EmsCommandLineTool()
print 'creating customer...'
cm = mc.getCustomerManager()
print 'executing amp cluster-location'
amptool.runCommand('cluster-location',array(['-r'],String))
args = []
args.append("-f" )
args.append( str(island))
args.append("-s" )
args.append( str(island))
args.append("-d" )
args.append( domain)
args.append( "-n" )
args.append("systest_journaling_customer" )
args.append("-e" )
args.append( "[email protected]" + domain)
args.append("-q")
if loadCorpus:
args.append( "-i" )
args.append( "/tmp/corpus")
args.append( "-o" )
args.append( "/ems/bigdisk/sftp.drop")
if isCloud:
args.append("--guid")
if isOnPremises:
args.append( "--bcc" )
if userAccounts is not None:
for address in userAccounts:
args.append("--user-account" )
args.append( address + "@" + domain )
print "creating journal-enabled customer "
Logger.getLogger( "cloud.py" ).info( "Creating systest_journaling_customer..." )
result = emscmdtool.runCommand('make-test-customer',args)
if result is False:
raise Exception('make-test-customer failed, customer already exists?')
ManagementContainer.getInstance().getMailRoutingConfigGenerator().waitForRegenComplete()
cust = cm.findCustomers([SearchConstraint(ICustomerManager.PROP_NAME, SearchConstraintOperator.CONSTRAINT_EQUALS, 'systest_journaling_customer')])
return cust[0]
示例8: _getVersion
def _getVersion(self, testScriptFileName):
from org.apache.log4j import Logger as _Logger, Level as _Level
# set log4j logger level to ERROR
rootLogger = _Logger.getRootLogger()
rootLevel = rootLogger.getLevel()
rootLogger.setLevel(_Level.ERROR)
from com.qspin.qtaste.util.versioncontrol import VersionControl
version = VersionControl.getInstance().getTestApiVersion(os.path.dirname(testScriptFileName))
rootLogger.setLevel(rootLevel)
return version
示例9: setUp
def setUp(self):
# Replik8db Properties...
Replik8dbProps = Properties("conf/replik8db.properties")
# Replik8db HDFS Cluster...
Replik8dbHdfsCluster = Replik8dbProps.getProperty("cluster.hdfs")
self.logger = Logger.getLogger("TestHdfsUtil")
# self.logger.setLevel(Level.DEBUG)
self.hu = HdfsUtil(Replik8dbHdfsCluster)
示例10: __init__
def __init__(self):
self.name = 'RedisPoolTest'
self.log = Logger.getLogger(self.name)
self.pool = ServiceRegistry.getService("testRedisPool")
if not self.pool:
self.log.info(self.name + ': creating pool...')
self.pool = redis.ConnectionPool(host='127.0.0.1', port=6379)
try:
ServiceRegistry.registerService("testRedisPool", self.pool)
finally:
pass
self.r = redis.Redis(connection_pool=self.pool)
self.log.info(self.name + ': init...')
示例11: __init__
def __init__(self, hdfsCluster):
self.logger = Logger.getLogger("Hdfs")
# self.logger.setLevel(Level.DEBUG)
coreSite = "/etc/hadoop/conf/core-site.xml"
hdfsSite = "/etc/hadoop/conf/hdfs-site.xml"
hdfsCluster = hdfsCluster
self.cHdfs = Configuration()
self.cHdfs.addResource(Path(coreSite))
self.cHdfs.addResource(Path(hdfsSite))
self.cHdfs.set("fs.defaultFS", hdfsCluster)
self.fileSystem = FileSystem.get(self.cHdfs)
self.fileUtil = FileUtil()
示例12: run_validators
def run_validators():
config_valid = True
validation_logger=Logger.getLogger('validation')
for val_dir in ['core/validators', os.path.join(site_home, 'custom/validators')]:
sys.path.append(val_dir)
for val_name in os.listdir(val_dir):
val_file = os.path.join(val_dir, val_name)
if os.path.isfile(val_file) and is_jython(val_file):
main_logger.debug('Running validator: ' + val_file)
result = call_extension(val_file, validation_logger)
if result == False:
config_valid = False
if not config_valid:
main_logger.error('There were validation errors with the configuration file\n\nBUILD FAILED - Invalid Configuration\n')
sys.exit()
示例13: __init__
def __init__(self):
self.name = 'PoolConTest'
self.log = Logger.getLogger(self.name)
ds = DataSourceRegistry.getDataSource('localSource')
if not ds:
props = Properties()
props.put("url", "jdbc:mysql://localhost/dataservice")
props.put("username", "root")
props.put("driverClassName", "com.mysql.jdbc.Driver")
props.put("password", "ben")
props.put("initialSize", "1")
props.put("minIdle", "5")
props.put("maxActive", "10")
try:
DataSourceRegistry.registerDataSource('localSource', props)
finally:
ds = DataSourceRegistry.getDataSource('localSource')
self.ds = ds
self.log.info(self.name + ': init...')
示例14: long
BYTES_COLUMN = 7 # if success, how many bytes in body?
RESOLVE_TIME_COLUMN = 9 #
CONNECT_TIME_COLUMN = 10 #
FIRST_BYTE_TIME_COLUMN = 11 #
# other constants
ALL_TRANSACTIONS_KEY = "0"
ALL_TRANSACTIONS_VALUE = "All Transactions"
TX_SEC_KEY = "passed"
THROUGHPUT_KEY = "kbSec"
SIMPLE_RESPONSE_TIME_KEY = "simple response time"
HTTP_RESPONSE_TIME_KEY = "http response time"
RESPONSE_TIME_MEAN_MAX_KEY = "response time mean max"
TABLE_MARKER = "Final statistics for this process"
SUPPORTED_JYTHON_VERSIONS = ["2.2.1", "2.5.0", "2.5.1", "2.5.2"]
TEST_START_TIME = long(0)
MAX_POSSIBLE_TIME = 99999999.9
logger = Logger.getLogger("analyzer")
# velocity merger and config classes instantiated in
# constants module to avoid creating duplicate instances
VORPAL = ga.constants.VORPAL
CONFIG = ga.constants.CONFIG
if __name__ == "__main__":
main()
示例15: import
'''
Created on Feb 19, 2013
@author: undesa
'''
from org.apache.log4j import Logger
import os
from const import (
__legislature_info__,
__parl_info__
)
LOG = Logger.getLogger("glue")
class COLOR(object):
"""
Color definitions used for color-coding significant runtime events
or raised exceptions as applied on python print() function
"""
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'