当前位置: 首页>>代码示例>>Python>>正文


Python Logging.log_init方法代码示例

本文整理汇总了Python中Logging.log_init方法的典型用法代码示例。如果您正苦于以下问题:Python Logging.log_init方法的具体用法?Python Logging.log_init怎么用?Python Logging.log_init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Logging的用法示例。


在下文中一共展示了Logging.log_init方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: import Logging [as 别名]
# 或者: from Logging import log_init [as 别名]
def main(argv = sys.argv):
    Logging.log_init('rsp2_bridge_wrapper', 'rsp2_bridge_wrapper', 0,
                     Logging.component_id(Logging.LCI_RSP), Logging.LOG_DEBUG,
                     Logging.LOG_LOCAL0, Logging.LCT_SYSLOG)

    build_vmware_db()
    set_up_signal_handlers()

    enable_vmware_bridging()

    # Spin waiting for signals.
    while (True):
        signal.pause()
开发者ID:akkmzack,项目名称:RIOS-8.5,代码行数:15,代码来源:vmware_bridge_wrapper.py

示例2: main

# 需要导入模块: import Logging [as 别名]
# 或者: from Logging import log_init [as 别名]
def main(argv = sys.argv):
    Logging.log_init('vmware_ws_interface_wrapper', 'vmware_ws_interface_wrapper', 0,
                     Logging.component_id(Logging.LCI_VSP), Logging.LOG_DEBUG,
                     Logging.LOG_LOCAL0, Logging.LCT_SYSLOG)

    interfaceName = ""

    try:
        opts, args = getopt.getopt(sys.argv[1:], "hpi:", ["help", "print","interface="])
    except getopt.GetoptError, err:
        # print help information and exit:
        print str(err) # will print something like "option -a not recognized"
        usage()
        sys.exit(2)
开发者ID:akkmzack,项目名称:RIOS-8.5,代码行数:16,代码来源:vmware_ws_interface_wrapper.py

示例3: main

# 需要导入模块: import Logging [as 别名]
# 或者: from Logging import log_init [as 别名]
def main():
    """!
    Entry point of the wrapper, intialize logger and signal handler. Starts
    vmware-vmx and starts monitoring it 
    """
    
    Logging.log_init('vmware_vmx_wrapper', 'vmware_vmx_wrapper', 0,
                     Logging.component_id(Logging.LCI_VSP), Logging.LOG_DEBUG,
                     Logging.LOG_LOCAL0, Logging.LCT_SYSLOG)
     
    Logging.log(Logging.LOG_INFO, 
                "vsp_vmware_vmx_wrapper started")
    
    signal.signal(signal.SIGINT, terminate_term_handler)
    signal.signal(signal.SIGTERM, terminate_term_handler)
    signal.signal(signal.SIGQUIT, terminate_quit_handler)
    signal.signal(signal.SIGUSR1, terminate_usr1_handler)
    
    #get the esxi dir
    esxi_dir = Vsp.get_esxi_dir()
    
    vmx_conf_file_path = "%s/%s" %(esxi_dir, ESXI_VMX_NAME)
      
    #Check if the vm configuration exists
    if not os.path.exists(vmx_conf_file_path): 
        Logging.log(Logging.LOG_ERR, 
                    "VM configuration %s doesn't exist" % vmx_conf_file_path)
        sys.exit(1)

    # Check if vmware-vmx is already running. The fuction returns None if no
    # process_id exists or if there's multiple process_ids associated with
    # the vmx_conf. However, it's not possible to launch two running vmware_vmx
    # using the same vmx_conf. The chance this returns None b/c of multiple
    # process ids is almost nonexistant. 
    proc_id = Vsp.get_vmx_proc_id(vmx_conf_file_path)

    #Start vmware-vmx if an instance has not been started
    if proc_id == None:

        # Clean up the "shutting down" file used for ESXi HPN dependency
        if os.path.exists(SHUTDOWN_MARKER):
            os.remove(SHUTDOWN_MARKER)
        cleanup_locks(esxi_dir)
        start_vmware_vmx(vmx_conf_file_path)

    #Get the new process id
    proc_id = Vsp.get_vmx_proc_id(vmx_conf_file_path)

    monitor_vmware_vmx(proc_id)
开发者ID:akkmzack,项目名称:RIOS-8.5,代码行数:51,代码来源:vsp_vmware_vmx_wrapper.py

示例4: main

# 需要导入模块: import Logging [as 别名]
# 或者: from Logging import log_init [as 别名]
def main():
    """!
    Entry point to the watchdog. Initialize logger and starts attempting to
    communicate with ESXi
    """
    global g_mgmtd_pid

    g_mgmtd_pid = None

    mgmtd_pids = []

    Logging.log_init('esxi_watchdog', 'esxi_watchdog', 0,
                     Logging.component_id(Logging.LCI_VSP), Logging.LOG_DEBUG,
                     Logging.LOG_LOCAL0, Logging.LCT_SYSLOG)

    Logging.log(Logging.LOG_INFO, "esxi watchdog started")

    # Bug 117274: It may happen that we get multiple pids for mgmtd process,
    # pidof ran between fork-exec call, retry to allow mgmtd to settle
    for i in range(1, MAX_MGMTD_SETTLE_RETRY):
        mgmtd_pids = Vsp.get_pids('mgmtd')
        if len(mgmtd_pids) > 1:
            # multiple pids detected, give mgmtd sometime to settle
            time.sleep(MGMTD_SETTLE_TIMEOUT)
        else:
            g_mgmtd_pid = mgmtd_pids[0]
            break

    # Bug 112192: monitor mgmtd pid, if mgmtd crashes/exits
    # terminate watchdog as well
    if g_mgmtd_pid == None:
        # mgmtd not up kill watchdog process
        Logging.log(Logging.LOG_ERR, "Mgmtd is not ready, kill watchdog!")
        sys.exit();

    Mgmt.open()
    signal.signal(signal.SIGINT, terminate_handler)
    signal.signal(signal.SIGTERM, terminate_handler)
    signal.signal(signal.SIGQUIT, terminate_handler)

    # Invalidate the session file if it exists on startup
    if os.path.exists(SESSION_FILE):
        os.remove(SESSION_FILE)

    monitor_esxi()
    Mgmt.close()
开发者ID:akkmzack,项目名称:RIOS-8.5,代码行数:48,代码来源:esxi_watchdog.py

示例5:

# 需要导入模块: import Logging [as 别名]
# 或者: from Logging import log_init [as 别名]
import sys
import os

workDir = '/opt/tms/web2/appserver'
webwareDir = '/opt/tms/web2/webware'
libraryDirs = ['/opt/tms/web2/pythonlib']

sys.path.insert(0, webwareDir)
for dir in libraryDirs:
    sys.path.insert(0, dir)
sys.argv = []

import Logging
Logging.log_init('webasd', 'web', 0,
                 Logging.component_id(Logging.LCI_WEB), Logging.LOG_DEBUG,
                 Logging.LOG_LOCAL0, Logging.LCT_SYSLOG)
Logging.log(Logging.LOG_INFO, 'Logging initialized for webasd')

tempDir = '/var/tmp'

# tempfile package uses this
os.environ['TMPDIR'] = tempDir
# fork/exec'ed CLI uses this
os.environ['USER'] = 'admin'

# clean out any old temporary upload files
for name in os.listdir(tempDir):
    if name.startswith('tmp_upload_'):
        os.unlink('%s/%s' % (tempDir, name))
开发者ID:akkmzack,项目名称:RIOS-8.5,代码行数:31,代码来源:Launch.py


注:本文中的Logging.log_init方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。