Пример #1
0
 /// 开启存储桶日志服务
 public void PutBucketLogging()
 {
     //.cssg-snippet-body-start:[put-bucket-logging]
     try
     {
         string bucket = "examplebucket-1250000000"; //格式:BucketName-APPID
         PutBucketLoggingRequest request = new PutBucketLoggingRequest(bucket);
         // 设置保存日志的目标路径
         request.SetTarget("targetbucket-1250000000", "logs/");
         //执行请求
         PutBucketLoggingResult result = cosXml.PutBucketLogging(request);
         //请求成功
         Console.WriteLine(result.GetResultInfo());
     }
     catch (COSXML.CosException.CosClientException clientEx)
     {
         //请求失败
         Console.WriteLine("CosClientException: " + clientEx);
     }
     catch (COSXML.CosException.CosServerException serverEx)
     {
         //请求失败
         Console.WriteLine("CosServerException: " + serverEx.GetInfo());
     }
     //.cssg-snippet-body-end
 }