为 Azure 机器学习工作室(经典版)Web 服务启用日志记录Enable logging for Azure Machine Learning Studio (classic) web services

适用于: yes机器学习工作室(经典) noAzure 机器学习APPLIES TO: yesMachine Learning Studio (classic) noAzure Machine Learning

本文档提供有关机器学习工作室(经典版)Web 服务的日志记录功能的信息。This document provides information on the logging capability of Machine Learning Studio (classic) web services. 日志记录可提供错误编号和消息以外的其他信息,这些信息有助于对调用机器学习工作室(经典版)API 进行故障排除。Logging provides additional information, beyond just an error number and a message, that can help you troubleshoot your calls to the Machine Learning Studio (classic) APIs.

如何为 Web 服务启用日志记录How to enable logging for a Web service

Azure 机器学习工作室(经典版)Web 服务门户中启用日志记录。You enable logging from the Azure Machine Learning Studio (classic) Web Services portal.

  1. https://services.azureml.net 登录到 Azure 机器学习工作室(经典版)Web 服务门户。Sign in to the Azure Machine Learning Studio (classic) Web Services portal at https://services.azureml.net. 对于经典 Web 服务,还可通过在工作室(经典版)中单击“机器学习工作室(经典版)Web 服务”页上的“新 Web 服务体验”,到达该门户 。For a Classic web service, you can also get to the portal by clicking New Web Services Experience on the Machine Learning Studio (classic) Web Services page in Studio (classic).

    新 Web 服务体验链接

  2. 在顶部菜单栏,单击“Web 服务”用作新 Web 服务,或单击“经典 Web 服务”用作经典 Web 服务 。On the top menu bar, click Web Services for a New web service, or click Classic Web Services for a Classic web service.

    选择新 Web 服务或经典 Web 服务

  3. 对于新 Web 服务,单击 Web 服务名称。For a New web service, click the web service name. 对于经典 Web 服务,单击 Web 服务名称,然后单击下一页上的相应终结点。For a Classic web service, click the web service name and then on the next page click the appropriate endpoint.

  4. 单击顶部菜单中的“配置” 。On the top menu bar, click Configure.

  5. 将“启用日志记录”选项设置为“错误”(用于仅记录错误)或“全部”(用于记录完整日志) 。Set the Enable Logging option to Error (to log only errors) or All (for full logging).

    选择日志记录级别

  6. 单击“保存” 。Click Save.

  7. 对于经典 Web 服务,创建“ml-diagnostics”容器 。For Classic web services, create the ml-diagnostics container.

    所有 Web 服务日志都保存在与此 Web 服务关联的存储帐户中名为“ml-diagnostics”的 blob 容器中 。All web service logs are kept in a blob container named ml-diagnostics in the storage account associated with the web service. 对于新 Web 服务,容器会在你首次访问该 Web 服务时创建。For New web services, this container is created the first time you access the web service. 对于经典 Web 服务,需在容器尚不存在时进行创建。For Classic web services, you need to create the container if it doesn't already exist.

    1. Azure 门户中,转到与此 Web 服务关联的存储帐户。In the Azure portal, go to the storage account associated with the web service.

    2. 单击“Blob 服务”下的“容器” 。Under Blob Service, click Containers.

    3. 如果容器“ml-diagnostics”不存在,请单击“+容器”,将容器命名为“ml-diagnostics”,然后选择“访问类型”作为“Blob” 。If the container ml-diagnostics doesn't exist, click +Container, give the container the name "ml-diagnostics", and select the Access type as "Blob". 单击“确定”。 Click OK.

      创建用来存储诊断日志的新容器

提示

对于经典 Web 服务,机器学习工作室(经典版)中的 Web 服务仪表板还具有启用日志记录的开关。For a Classic web service, the Web Services Dashboard in Machine Learning Studio (classic) also has a switch to enable logging. 但是,由于日志记录现在通过 Web 服务门户进行托管,因此需通过该门户启用日志记录,如本文所述。However, because logging is now managed through the Web Services portal, you need to enable logging through the portal as described in this article. 如果已在工作室(经典版)中启用日志记录,则需在 Web 服务门户中禁用日志记录并再次启用。If you already enabled logging in Studio (classic), then in the Web Services Portal, disable logging and enable it again.

启用日志记录的效果The effects of enabling logging

启用日志记录后,来自 Web 服务终结点的诊断和错误将记录在与用户工作区链接的 Azure 存储帐户的“ml-diagnostics” blob 容器中。When logging is enabled, the diagnostics and errors from the web service endpoint are logged in the ml-diagnostics blob container in the Azure Storage Account linked with the user's workspace. 此容器承载与此存储帐户相关联的所有工作区的所有 Web 服务终结点的所有诊断信息。This container holds all the diagnostics information for all the web service endpoints for all the workspaces associated with this storage account.

可使用可用于浏览 Azure 存储帐户的多种工具中的任意一种查看日志。The logs can be viewed using any of the several tools available to explore an Azure Storage Account. 最简单的方法是导航到 Azure 门户中的存储帐户,单击“门户”,然后单击容器“ml-diagnostics” 。The easiest may be to navigate to the storage account in the Azure portal, click Containers, and then click the container ml-diagnostics.

日志 blob 详细信息Log blob detail information

容器中的每个 blob 承载完全匹配以下操作之一的诊断信息:Each blob in the container holds the diagnostics information for exactly one of the following actions:

  • 执行 Batch-Execution 方法An execution of the Batch-Execution method
  • 执行 Request-Response 方法An execution of the Request-Response method
  • 初始化 Request-Response 容器Initialization of a Request-Response container

每个 blob 的名称都具有以下形式的前缀:The name of each blob has a prefix of the following form:

{Workspace Id}-{Web service Id}-{Endpoint Id}/{Log type}

其中“日志类型”是以下值之一 :Where Log type is one of the following values:

  • 批处理batch
  • score/requestsscore/requests
  • score/initscore/init