【问题标题】:How to Enable the Client-side Logging with the Azure Storage Client Library(Ver 12) for Java如何使用适用于 Java 的 Azure 存储客户端库(Ver 12)启用客户端日志记录
【发布时间】:2020-04-26 20:17:30
【问题描述】:

我想使用 Azure blob 存储在客户端站点记录请求/响应 Java sdk(ver12)。

在微软在线文档 [https://docs.microsoft.com/en-us/rest/api/storageservices/client-side-logging-with-the-microsoft-azure-storage-sdk-for-java],我找到了这个示例代码。

// Set logging off by default.  
OperationContext.setLoggingEnabledByDefault(false);  
OperationContext ctx = new OperationContext();  
ctx.setLoggingEnabled(true);  

// Create an operation to add a new customer to the people table.  
TableOperation insertCustomer1 = TableOperation.insertOrReplace(customer1);  

// Submit the operation to the table service.  
table.execute(insertCustomer1, null, ctx);  

但它不起作用。 OperationContext 在库中找不到。可能是旧版本示例。

希望有人能给我一个示例代码,谢谢。

【问题讨论】:

    标签: azure-blob-storage


    【解决方案1】:

    OperationContext 是com.microsoft.azure.storage 的一个类,而最新版本是8.6.3。

    您可以在 Microsoft Azure Storage SDK v8 for Java 中获得OperationContext 类。

    如果您想访问我们的latest Java SDK,请参阅下表中的 Storage SDK v12 for Java 链接。如果您想了解有关我们升级 Java SDK 的决定和前进道路的更多信息,请参阅this document。如果您想了解更多有关 Azure 为协调跨服务 SDK 开发所做的迅速努力(此更改是其中的一部分),请参阅本文。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-05-22
      • 2011-07-07
      • 2013-11-11
      • 2013-04-09
      相关资源
      最近更新 更多