Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit35e6ce1

Browse files
author
wallisyan
committed
modify add_logger
1 parent92a3e45 commit35e6ce1

File tree

7 files changed

+17
-23
lines changed

7 files changed

+17
-23
lines changed

‎aliyun-python-sdk-core/aliyunsdkcore/auth/signers/access_key_signer.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ def __init__(self, access_key_credential):
3030
self._credential=access_key_credential
3131

3232
defsign(self,region_id,request):
33-
logger.debug("Calculating signature using AccessKey.")
3433
cred=self._credential
3534
header=request.get_signed_header(region_id,cred.access_key_id,cred.access_key_secret)
3635
url=request.get_url(region_id,cred.access_key_id,cred.access_key_secret)

‎aliyun-python-sdk-core/aliyunsdkcore/auth/signers/ecs_ram_role_signer.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ def __init__(self, ecs_ram_role_credential):
3939
self._expiration=0
4040

4141
defsign(self,region_id,request):
42-
logger.debug("Calculating signature using EcsRamRole.")
4342
self._check_session_credential()
4443
session_ak,session_sk,token=self._session_credential
4544
ifrequest.get_style()=='RPC':

‎aliyun-python-sdk-core/aliyunsdkcore/auth/signers/ram_role_arn_signer.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ def __init__(self, credential, do_action_api):
5050
self._credential.session_role_name="aliyun-python-sdk-"+str(time.time())
5151

5252
defsign(self,region_id,request):
53-
logger.debug("Calculating signature using RamRoleArn.")
5453
self._check_session_credential()
5554
session_ak,session_sk,token=self._session_credential
5655
ifrequest.get_style()=='RPC':

‎aliyun-python-sdk-core/aliyunsdkcore/auth/signers/rsa_key_pair_signer.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ def __init__(self, credential, region_id, debug=False):
3939
self._session_credential=None
4040

4141
defsign(self,region_id,request):
42-
logger.debug("Calculating signature using RsaKeyPair.")
4342
self._check_session_credential()
4443
session_ak,session_sk=self._session_credential
4544
header=request.get_signed_header(region_id,session_ak,session_sk)

‎aliyun-python-sdk-core/aliyunsdkcore/auth/signers/sts_token_signer.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ def __init__(self, sts_credential):
3131
self._credential=sts_credential
3232

3333
defsign(self,region_id,request):
34-
logger.debug("Calculating signature using StsToken.")
3534
sts_cred=self._credential
3635
ifrequest.get_style()=='RPC':
3736
request.add_query_param("SecurityToken",sts_cred.sts_token)

‎aliyun-python-sdk-core/aliyunsdkcore/client.py‎

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
importjson
2424
importlogging
2525
importjmespath
26+
importcopy
2627

2728
importaliyunsdkcore
2829
fromaliyunsdkcore.vendored.six.moves.urllib.parseimporturlencode
@@ -59,7 +60,7 @@
5960

6061

6162
classAcsClient:
62-
LOG_FORMAT='%(asctime)s-%(name)s-%(levelname)s - %(message)s'
63+
LOG_FORMAT='%(thread)d %(asctime)s %(name)s %(levelname)s %(message)s'
6364

6465
def__init__(
6566
self,
@@ -270,10 +271,10 @@ def _handle_retry_and_timeout(self, endpoint, request, signer):
270271
retryable=self._retry_policy.should_retry(retry_policy_context)
271272
ifretryable&RetryCondition.NO_RETRY:
272273
break
273-
logger.debug("Retry needed, request is: %s",request.get_action_name())
274+
logger.debug("Retry needed Request:%s Retries :%d",
275+
request.get_action_name(),retries)
274276
retry_policy_context.retryable=retryable
275277
time_to_sleep=self._retry_policy.compute_delay_before_next_retry(retry_policy_context)
276-
logger.debug('Retry %s times',retries)
277278
time.sleep(time_to_sleep/1000.0)
278279
retries+=1
279280

@@ -284,20 +285,18 @@ def _handle_retry_and_timeout(self, endpoint, request, signer):
284285

285286
def_handle_single_request(self,endpoint,request,timeout,signer):
286287
http_response=self._make_http_response(endpoint,request,timeout,signer)
287-
params=request.get_query_params()
288+
params=copy.deepcopy(request.get_query_params())
288289
params.pop('AccessKeyId',None)
289-
logger.debug('The request params are %s',str(params))
290+
logger.debug('Request params are %s',str(params))
290291

291292
# Do the actual network thing
292293
try:
293294
status,headers,body=http_response.get_response_object()
294295
exceptIOErrorase:
295-
error_message=str(e)
296-
error_message+="\nEndpoint: "+endpoint
297-
logger.error('Catch a HttpError when connect to %s, current sdk version is %s',
298-
endpoint,aliyunsdkcore.__version__,exc_info=True)
296+
logger.error("HttpError occurred Host:%s SDK-Version:%s",
297+
endpoint,aliyunsdkcore.__version__)
299298

300-
exception=ClientException(error_code.SDK_HTTP_ERROR,error_message)
299+
exception=ClientException(error_code.SDK_HTTP_ERROR,str(e))
301300
returnNone,None,None,exception
302301

303302
exception=self._get_server_exception(status,body)
@@ -316,7 +315,7 @@ def _parse_error_info_from_response_body(response_body):
316315
error_message_to_return=body_obj['Message']
317316
exceptValueError:
318317
# failed to parse body as json format
319-
logger.warning('failed to parseresponse bodyas json format')
318+
logger.warning('Failed to parseResponse:%sas json format.',response_body)
320319

321320
returnerror_code_to_return,error_message_to_return
322321

@@ -329,7 +328,7 @@ def _get_server_exception(self, http_status, response_body):
329328
except (ValueError,TypeError,AttributeError):
330329
# in case the response body is not a json string, return the raw
331330
# data instead
332-
logger.warning('failed to parseresponse bodyas json format')
331+
logger.warning('Failed to parseResponse:%sas json format.',response_body)
333332

334333
ifhttp_status<codes.OKorhttp_status>=codes.MULTIPLE_CHOICES:
335334

‎aliyun-python-sdk-core/aliyunsdkcore/retry/retry_condition.py‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ def should_retry(self, retry_policy_context):
6262
ifretry_policy_context.retries_attempted<self.max_retry_times:
6363
returnRetryCondition.SHOULD_RETRY
6464
else:
65-
logger.debug("Reached the maximum number of retry "
66-
"attempts: %s",retry_policy_context.retries_attempted)
65+
logger.debug("Reached the maximum number of retry,Attempts:%d",
66+
retry_policy_context.retries_attempted)
6767
returnRetryCondition.NO_RETRY
6868

6969

@@ -78,7 +78,7 @@ def should_retry(self, retry_policy_context):
7878

7979
ifisinstance(exception,ClientException):
8080
ifexception.get_error_code()==error_code.SDK_HTTP_ERROR:
81-
logger.debug("Retry needed, retryableClientExceptioncaught:%s",
81+
logger.debug("RetryableClientExceptionoccurred,ClientException:%s",
8282
exception,exc_info=True)
8383
returnRetryCondition.SHOULD_RETRY
8484

@@ -88,15 +88,15 @@ def should_retry(self, retry_policy_context):
8888
request,
8989
self.retry_config)
9090
ifisinstance(normal_errors,list)anderror_code_innormal_errors:
91-
logger.debug("Retry needed, retryableServerExceptioncaught:%s",
91+
logger.debug("RetryableServerExceptionoccurred,ServerException:%s",
9292
exception,exc_info=True)
9393
returnRetryCondition.SHOULD_RETRY
9494

9595
throttling_errors=_find_data_in_retry_config("RetryableThrottlingErrors",
9696
request,
9797
self.retry_config)
9898
ifisinstance(throttling_errors,list)anderror_code_inthrottling_errors:
99-
logger.debug("Retry needed, retryableThrottlingErrorcaught:%s",
99+
logger.debug("RetryableThrottlingErroroccurred,ThrottlingError:%s",
100100
exception,exc_info=True)
101101
returnRetryCondition.SHOULD_RETRY| \
102102
RetryCondition.SHOULD_RETRY_WITH_THROTTLING_BACKOFF
@@ -119,7 +119,7 @@ def __init__(self, retryable_http_status_list=None):
119119
defshould_retry(self,retry_policy_context):
120120
ifretry_policy_context.http_status_codeinself.retryable_http_status_list:
121121
logger.debug(
122-
"Retry needed: retryableHTTP status code received: %s",
122+
"Retryable HTTP error occurred,HTTP status code: %s",
123123
retry_policy_context.http_status_code)
124124
returnRetryCondition.SHOULD_RETRY
125125
else:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp