當前位置: 首頁>>代碼示例>>Python>>正文


Python LogFactory.info方法代碼示例

本文整理匯總了Python中modules.util.log.LogFactory.info方法的典型用法代碼示例。如果您正苦於以下問題:Python LogFactory.info方法的具體用法?Python LogFactory.info怎麽用?Python LogFactory.info使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在modules.util.log.LogFactory的用法示例。


在下文中一共展示了LogFactory.info方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: run_plugin

# 需要導入模塊: from modules.util.log import LogFactory [as 別名]
# 或者: from modules.util.log.LogFactory import info [as 別名]
    def run_plugin(self, values):
        log = LogFactory().get_log(__name__)
        # wait till SAML_ENDPOINT becomes available
        mds_response = None
        while mds_response is None:
            log.debug("Waiting for SAML_ENDPOINT to be available from metadata service for app ID: %s" % values["APPLICATION_ID"])
            time.sleep(5)
            mds_response = mdsclient.get(app=True)
            if mds_response is not None and mds_response.properties.get("SAML_ENDPOINT") is None:
                mds_response = None

        saml_endpoint = mds_response.properties["SAML_ENDPOINT"]
        log.debug("SAML_ENDPOINT value read from Metadata service: %s" % saml_endpoint)

        # start tomcat
        tomcat_start_command = "exec /opt/tomcat/bin/startup.sh"
        log.info("Starting Tomcat server: [command] %s, [STRATOS_SAML_ENDPOINT] %s" % (tomcat_start_command, saml_endpoint))
        env_var = os.environ.copy()
        env_var["STRATOS_SAML_ENDPOINT"] = saml_endpoint

        env_var["STRATOS_HOST_NAME"] = values["HOST_NAME"]
        payload_ports = values["PORT_MAPPINGS"].split("|")
        if values.get("LB_CLUSTER_ID") is not None:
            port_no = payload_ports[2].split(":")[1]
        else:
            port_no = payload_ports[1].split(":")[1]
        env_var["STRATOS_HOST_PORT"] = port_no

        p = subprocess.Popen(tomcat_start_command, env=env_var, shell=True)
        output, errors = p.communicate()
        log.debug("Tomcat server started")
開發者ID:jeradrutnam,項目名稱:stratos,代碼行數:33,代碼來源:TomcatServerStarterPlugin.py

示例2: MessageBrokerHeartBeatChecker

# 需要導入模塊: from modules.util.log import LogFactory [as 別名]
# 或者: from modules.util.log.LogFactory import info [as 別名]
class MessageBrokerHeartBeatChecker(AbstractAsyncScheduledTask):
    """
    A scheduled task to periodically check if the connected message broker is online.
    If the message broker goes offline, it will disconnect the currently connected
    client object and it will return from the loop_forever() method.
    """

    def __init__(self, connected_client, mb_ip, mb_port, username=None, password=None):
        self.__mb_client = mqtt.Client()

        if username is not None:
            self.__mb_client.username_pw_set(username, password)

        self.__mb_ip = mb_ip
        self.__mb_port = mb_port
        self.__connected_client = connected_client
        self.__log = LogFactory().get_log(__name__)

    def execute_task(self):
        try:
            self.__mb_client.connect(self.__mb_ip, self.__mb_port, 60)
            self.__mb_client.disconnect()
        except Exception:
            self.__log.info(
                "Message broker %s:%s cannot be reached. Disconnecting client..." % (self.__mb_ip, self.__mb_port))
            self.__connected_client.disconnect()
開發者ID:gayangunarathne,項目名稱:private-paas,代碼行數:28,代碼來源:subscriber.py

示例3: export_env_var

# 需要導入模塊: from modules.util.log import LogFactory [as 別名]
# 或者: from modules.util.log.LogFactory import info [as 別名]
 def export_env_var(self, variable, value):
     log = LogFactory().get_log(__name__)
     if value is not None:
         os.environ[variable] = value
         log.info("Exported environment variable %s: %s" % (variable, value))
     else:
         log.warn("Could not export environment variable %s " % variable)
開發者ID:lasinducharith,項目名稱:product-private-paas,代碼行數:9,代碼來源:wso2esb-startup-handler.py

示例4: run_plugin

# 需要導入模塊: from modules.util.log import LogFactory [as 別名]
# 或者: from modules.util.log.LogFactory import info [as 別名]
    def run_plugin(self, values):
        log = LogFactory().get_log(__name__)

        log.info("Reading the Complete Topology in order to get the dependent ip addresses ...")

        topology = values["TOPOLOGY_JSON"]
        topology_str = json.loads(topology)

        master_ip = None

        if topology_str is not None:
            # add service map
            for service_name in topology_str["serviceMap"]:
                service_str = topology_str["serviceMap"][service_name]
                if service_name == "hadoop" :
                    # add cluster map
                    for cluster_id in service_str["clusterIdClusterMap"]:
                        cluster_str = service_str["clusterIdClusterMap"][cluster_id]
                        # add member map
                        for member_id in cluster_str["memberMap"]:
                            member_str = cluster_str["memberMap"][member_id]
                            if master_ip is None:
                                master_ip = member_str["defaultPrivateIP"]
                                os.environ["CONFIG_PARAM_HADOOP_MASTER"] = master_ip

        log.info("configured master ip - ")
        log.info(master_ip)

        # configure server
        log.info("Configuring Hadoop...")
        config_command = "python /opt/ppaas-configurator-4.1.0-SNAPSHOT/configurator.py"
        env_var = os.environ.copy()
        p = subprocess.Popen(config_command, env=env_var, shell=True)
        output, errors = p.communicate()
        log.info("Hadoop configured successfully")
開發者ID:gayangunarathne,項目名稱:wso2privatepaas,代碼行數:37,代碼來源:hadoop-topology-handler.py

示例5: run_plugin

# 需要導入模塊: from modules.util.log import LogFactory [as 別名]
# 或者: from modules.util.log.LogFactory import info [as 別名]
    def run_plugin(self, values):
        log = LogFactory().get_log(__name__)
        # start tomcat
        tomcat_start_command = "exec ${CATALINA_HOME}/bin/startup.sh"
        log.info("Starting Tomcat server: [command] %s" % tomcat_start_command)

        p = subprocess.Popen(tomcat_start_command, shell=True)
        output, errors = p.communicate()
        log.debug("Tomcat server started: [command] %s, [output] %s" % (p.args, output))
開發者ID:AlmavivA,項目名稱:stratos,代碼行數:11,代碼來源:TomcatServerStarterPlugin.py

示例6: checkout

# 需要導入模塊: from modules.util.log import LogFactory [as 別名]
# 或者: from modules.util.log.LogFactory import info [as 別名]
 def checkout(self, repo_info):
     log = LogFactory().get_log(__name__)
     try:
         log.info("Running extension for checkout job")
         repo_info = values['REPO_INFO']
         git_repo = AgentGitHandler.create_git_repo(repo_info)
         AgentGitHandler.add_repo(git_repo)
     except Exception as e:
         log.exception("Error while executing CheckoutJobHandler extension: %s" % e)
開發者ID:AlmavivA,項目名稱:private-paas,代碼行數:11,代碼來源:checkout-job-handler.py

示例7: run_plugin

# 需要導入模塊: from modules.util.log import LogFactory [as 別名]
# 或者: from modules.util.log.LogFactory import info [as 別名]
    def run_plugin(self, values):
        log = LogFactory().get_log(__name__)

        # start server
        log.info("Starting APACHE STORM SUPERVISOR...")

        start_command = "${CARBON_HOME}/bin/storm supervisor"
        env_var = os.environ.copy()
        p = subprocess.Popen(start_command, env=env_var, shell=True)
        output, errors = p.communicate()
        log.debug("APACHE STORM SUPERVISOR started successfully")
開發者ID:gayangunarathne,項目名稱:wso2privatepaas,代碼行數:13,代碼來源:apache-storm-startup-handler.py

示例8: run_plugin

# 需要導入模塊: from modules.util.log import LogFactory [as 別名]
# 或者: from modules.util.log.LogFactory import info [as 別名]
 def run_plugin(self, values):
     log = LogFactory().get_log(__name__)
     
     os.environ["GIT_SSL_NO_VERIFY"] = "1"
     
     s2gitDomain = values.get("S2GIT_DOMAIN")
     s2gitIP = values.get("S2GIT_IP")
     entry_command = "echo '"+ s2gitIP + " "+  s2gitDomain + "' >> /etc/hosts"
     env_var = os.environ.copy()
     p = subprocess.Popen(entry_command, env=env_var, shell=True)
     output, errors = p.communicate()
     log.info("S2git host entry added successfully")
開發者ID:billhu422,項目名稱:product-af,代碼行數:14,代碼來源:TomcatServerStarterPlugin.py

示例9: run_plugin

# 需要導入模塊: from modules.util.log import LogFactory [as 別名]
# 或者: from modules.util.log.LogFactory import info [as 別名]
    def run_plugin(self, values):
        log = LogFactory().get_log(__name__)

        log.info("Reading environment variables...")
        clustering_enable= os.environ.get('CLUSTER')
        log.info(clustering_enable)

        if clustering_enable == 'true':

            # start server
            log.info("Starting Hadoop Namenode ...")

            format_namenode_command = "exec ${HADOOP_HOME}/bin/hadoop namenode -format"
            env_var = os.environ.copy()
            p = subprocess.Popen(format_namenode_command, env=env_var, shell=True)
            output, errors = p.communicate()

            start_command = "exec ${HADOOP_HOME}/sbin/start-all.sh"
            env_var = os.environ.copy()
            p = subprocess.Popen(start_command, env=env_var, shell=True)
            output, errors = p.communicate()

            log.debug("Hadoop Namenode started successfully")

        else:

            # start server
            log.info("Starting Hadoop Datanode ...")

            start_command = "exec ${HADOOP_HOME}/sbin/hadoop-daemon.sh start datanode"
            env_var = os.environ.copy()
            p = subprocess.Popen(start_command, env=env_var, shell=True)
            output, errors = p.communicate()

            log.debug("Hadoop Datanode started successfully")
開發者ID:gayangunarathne,項目名稱:wso2privatepaas,代碼行數:37,代碼來源:hadoop-startup-handler.py

示例10: run_plugin

# 需要導入模塊: from modules.util.log import LogFactory [as 別名]
# 或者: from modules.util.log.LogFactory import info [as 別名]
    def run_plugin(self, values):
        log = LogFactory().get_log(__name__)
        event_name = values["EVENT"]
        log.debug("Running extension for %s" % event_name)
        extension_values = {}
        for key in values.keys():
            extension_values["STRATOS_" + key] = values[key]
            # log.debug("%s => %s" % ("STRATOS_" + key, extension_values["STRATOS_" + key]))

        try:
            output, errors = ExtensionExecutor.execute_script(event_name + ".sh")
        except OSError:
            raise RuntimeError("Could not find an extension file for event %s" % event_name)

        if len(errors) > 0:
            raise RuntimeError("Extension execution failed for script %s: %s" % (event_name, errors))

        log.info("%s Extension executed. [output]: %s" % (event_name, output))
開發者ID:agentmilindu,項目名稱:stratos,代碼行數:20,代碼來源:ExtensionExecutor.py

示例11: run_plugin

# 需要導入模塊: from modules.util.log import LogFactory [as 別名]
# 或者: from modules.util.log.LogFactory import info [as 別名]
    def run_plugin(self, values):
        log = LogFactory().get_log(__name__)

        log.info("Reading port mappings...")
        port_mappings_str = values["PORT_MAPPINGS"]

        mgt_console_https_port = None

        # port mappings format: """NAME:mgt-console|PROTOCOL:https|PORT:4500|PROXY_PORT:9443"""

        log.info("Port mappings: %s" % port_mappings_str)
        if port_mappings_str is not None:

            port_mappings_array = port_mappings_str.split(";")
            if port_mappings_array:

                for port_mapping in port_mappings_array:
                    log.debug("port_mapping: %s" % port_mapping)
                    name_value_array = port_mapping.split("|")
                    name = name_value_array[0].split(":")[1]
                    protocol = name_value_array[1].split(":")[1]
                    port = name_value_array[2].split(":")[1]
                    if name == "mgt-console" and protocol == "https":
                        mgt_console_https_port = port

        log.info("Kubernetes service management console https port: %s" % mgt_console_https_port)
        if mgt_console_https_port is not None:
            command = "sed -i \"s/^#CONFIG_PARAM_HTTPS_PROXY_PORT = .*/CONFIG_PARAM_HTTPS_PROXY_PORT = %s/g\" %s" % (mgt_console_https_port, "${CONFIGURATOR_HOME}/template-modules/wso2cep-4.0.0/module.ini")
            p = subprocess.Popen(command, shell=True)
            output, errors = p.communicate()
            log.info("Successfully updated management console https proxy port: %s in CEP template module" % mgt_console_https_port)

        # start server
        log.info("Starting WSO2 CEP...")

        start_command = "exec ${CARBON_HOME}/bin/wso2server.sh start"
        env_var = os.environ.copy()
        p = subprocess.Popen(start_command, env=env_var, shell=True)
        output, errors = p.communicate()
        log.debug("WSO2 CEP started successfully")
開發者ID:gayangunarathne,項目名稱:wso2privatepaas,代碼行數:42,代碼來源:wso2cep-startup-handler.py

示例12: run_plugin

# 需要導入模塊: from modules.util.log import LogFactory [as 別名]
# 或者: from modules.util.log.LogFactory import info [as 別名]
    def run_plugin(self, values):
        log = LogFactory().get_log(__name__)
        MYSQL_ROOT_PASSWORD = os.environ["MYSQL_ROOT_PASSWORD"];
        TEMP_FILE_PATH="/tmp/temp.sql"
        log.info("MYSQL_ROOT_PASSWORD : %s" % MYSQL_ROOT_PASSWORD)
        f = open(TEMP_FILE_PATH, "w+")
        f.write(
            "USE mysql;\n"
            "FLUSH PRIVILEGES;\n"
            "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;\n"
            "UPDATE user SET password=PASSWORD('" + MYSQL_ROOT_PASSWORD + "') WHERE user='root';")
        f.close()

        log.info("Temp File created")

        mysql_command = "/usr/sbin/mysqld --bootstrap --verbose=0 < "+TEMP_FILE_PATH
        env_var = os.environ.copy()
        p = subprocess.Popen(mysql_command, env=env_var, shell=True)
        output, errors = p.communicate()
        log.info("%s file executed" %TEMP_FILE_PATH)

        mysql_start_command = "service mysql restart"
        p = subprocess.Popen(mysql_start_command, env=env_var, shell=True)
        output, errors = p.communicate()
        log.debug("mysql started successfully")

        # get local ip as to export to metadata
        get_local_ip_cmd = "awk 'NR==1 {print $1}' /etc/hosts"
        local_ip = subprocess.check_output(get_local_ip_cmd, shell=True)

        if local_ip is not None:
            local_ip = local_ip[0:-1]
        log.info("local IP from /etc/hosts : %s " % local_ip)

        # publishing to metadata service
        mysql_host = {"key": "MYSQL_HOST", "values": local_ip}
        mysql_password = {"key": "MYSQL_ROOT_PASSWORD", "values": MYSQL_ROOT_PASSWORD}
        mysql_username = {"key": "MYSQL_ROOT_USERNAME", "values": "root"}

        self.publish_metadata(mysql_host)
        self.publish_metadata(mysql_username)
        self.publish_metadata(mysql_password)
開發者ID:lasinducharith,項目名稱:product-private-paas,代碼行數:44,代碼來源:mysql-startup-handler.py

示例13: run_plugin

# 需要導入模塊: from modules.util.log import LogFactory [as 別名]
# 或者: from modules.util.log.LogFactory import info [as 別名]
    def run_plugin(self, values):
        log = LogFactory().get_log(__name__)
        # configure server
        log.info("Configuring APACHE STORM UI...")
        config_command = "exec /opt/ppaas-configurator-4.1.0-SNAPSHOT/configurator.py"
        env_var = os.environ.copy()
        p = subprocess.Popen(config_command, env=env_var, shell=True)
        output, errors = p.communicate()
        log.info("APACHE STORM UI configured successfully")

        # start server
        log.info("Starting APACHE STORM UI...")

        start_command = "${CARBON_HOME}/bin/storm ui"
        env_var = os.environ.copy()
        p = subprocess.Popen(start_command, env=env_var, shell=True)
        output, errors = p.communicate()
        log.debug("APACHE STORM UI started successfully")
開發者ID:JaneAarthy,項目名稱:product-private-paas,代碼行數:20,代碼來源:apache-storm-startup-ui-handler.py

示例14: run_plugin

# 需要導入模塊: from modules.util.log import LogFactory [as 別名]
# 或者: from modules.util.log.LogFactory import info [as 別名]
    def run_plugin(self, values):
        log = LogFactory().get_log(__name__)

        log.info("Starting tomcat metadata publisher...")
        # publish callback and issuer id from tomcat for IS to pickup
        publish_data = mdsclient.MDSPutRequest()
        # hostname_entry = {"key": "TOMCAT_HOSTNAME", "values": member_hostname}
        cluster_hostname = values["HOST_NAME"]

        log.info("Reading port mappings...")
        port_mappings_str = values["PORT_MAPPINGS"]
        tomcat_http_port = None

        # port mappings format: """NAME:mgt-console|PROTOCOL:https|PORT:4500|PROXY_PORT:8443;
        #                          NAME:tomcat-http|PROTOCOL:http|PORT:4501|PROXY_PORT:7280;"""

        log.info("Port mappings: %s" % port_mappings_str)
        if port_mappings_str is not None:

            port_mappings_array = port_mappings_str.split(";")
            if port_mappings_array:

                for port_mapping in port_mappings_array:
                    log.debug("port_mapping: %s" % port_mapping)
                    name_value_array = port_mapping.split("|")
                    name = name_value_array[0].split(":")[1]
                    protocol = name_value_array[1].split(":")[1]
                    port = name_value_array[2].split(":")[1]
                    if name == "tomcat-http" and protocol == "http":
                        tomcat_http_port = port

        log.info("Kubernetes service port of tomcat http transport: %s" % tomcat_http_port)

        callback_url = "http://%s:%s/travelocity.com/home.jsp" % (cluster_hostname, tomcat_http_port)

        callback_url_property = {"key": "CALLBACK_URL", "values": [callback_url]}
        mdsclient.put(callback_url_property, app=True)
        log.info("Published property to metadata API: CALLBACK_URL: %s" % callback_url)

        issuer_property = {"key": "SSO_ISSUER", "values": ["travelocity.com"]}
        mdsclient.put(issuer_property, app=True)
        log.info("Published property to metadata API: SSO_ISSUER: travelocity.com")

        log.info("Tomcat metadata publisher completed")
開發者ID:ravihansa3000,項目名稱:stratos,代碼行數:46,代碼來源:TomcatWSO2ISMetadataPublisher.py

示例15: run_plugin

# 需要導入模塊: from modules.util.log import LogFactory [as 別名]
# 或者: from modules.util.log.LogFactory import info [as 別名]
    def run_plugin(self, values):
        log = LogFactory().get_log(__name__)

        log.info("Reading the Complete Topology in order to get the dependent ip addresses ...")

        topology_str = values["TOPOLOGY_JSON"]
        log.info("Port mappings: %s" % topology_str)

        zookeeper_member_default_private_ip = None
        nimbus_member_default_private_ip = None

        if topology_str is not None:
            # add service map
            for service_name in topology_str["serviceMap"]:
                service_str = topology_str["serviceMap"][service_name]
                if service_name == "zookeeper" :
                    # add cluster map
                    for cluster_id in service_str["clusterIdClusterMap"]:
                        cluster_str = service_str["clusterIdClusterMap"][cluster_id]
                        # add member map
                        for member_id in cluster_str["memberMap"]:
                            member_str = cluster_str["memberMap"][member_id]
                            if zookeeper_member_default_private_ip is None:
                                zookeeper_member_default_private_ip = member_str["defaultPrivateIP"]

                if service_name == "nimbus" :
                    # add cluster map
                    for cluster_id in service_str["clusterIdClusterMap"]:
                        cluster_str = service_str["clusterIdClusterMap"][cluster_id]
                        # add member map
                        for member_id in cluster_str["memberMap"]:
                            member_str = cluster_str["memberMap"][member_id]
                            if nimbus_member_default_private_ip is None:
                                nimbus_member_default_private_ip = member_str["defaultPrivateIP"]



        if zookeeper_member_default_private_ip is not None:
            command = "sed -i \"s/^#ZOOKEEPER_HOSTNAME = .*/ZOOKEEPER_HOSTNAME = %s/g\" %s" % (zookeeper_member_default_private_ip, "${CONFIGURATOR_HOME}/template-modules/apache-storm-0.9.5/module.ini")
            p = subprocess.Popen(command, shell=True)
            output, errors = p.communicate()
            log.info("Successfully updated zookeeper hostname: %s in Apache Storm template module" % zookeeper_member_default_private_ip)

        if nimbus_member_default_private_ip is not None:
            command = "sed -i \"s/^#ZOOKEEPER_HOSTNAME = .*/ZOOKEEPER_HOSTNAME = %s/g\" %s" % (nimbus_member_default_private_ip, "${CONFIGURATOR_HOME}/template-modules/apache-storm-0.9.5/module.ini")
            p = subprocess.Popen(command, shell=True)
            output, errors = p.communicate()
            log.info("Successfully updated nimbus hostname: %s in Apache Storm template module" % nimbus_member_default_private_ip)

        # configure server
        log.info("Configuring Apache Storm Supervisor...")
        config_command = "exec /opt/ppaas-configurator-4.1.0-SNAPSHOT/configurator.py"
        env_var = os.environ.copy()
        p = subprocess.Popen(config_command, env=env_var, shell=True)
        output, errors = p.communicate()
        log.info("Apache Storm configured successfully")

        # start server
        log.info("Starting Apache Storm...")

        start_command = "exec ${CARBON_HOME}/bin/storm supervisor"
        env_var = os.environ.copy()
        p = subprocess.Popen(start_command, env=env_var, shell=True)
        output, errors = p.communicate()
        log.debug("Apache Storm started successfully")
開發者ID:JaneAarthy,項目名稱:product-private-paas,代碼行數:67,代碼來源:apache-storm-topology-handler.py


注:本文中的modules.util.log.LogFactory.info方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。