Merge pull request #2182 from alphagov/add-more-information-to-log

Added inbound_sms_id to log output
This commit is contained in:
Rebecca Law
2018-10-25 11:12:46 +01:00
committed by GitHub

View File

@@ -274,10 +274,10 @@ def save_email(self,
@notify_celery.task(bind=True, name="save-letter", max_retries=5, default_retry_delay=300) @notify_celery.task(bind=True, name="save-letter", max_retries=5, default_retry_delay=300)
@statsd(namespace="tasks") @statsd(namespace="tasks")
def save_letter( def save_letter(
self, self,
service_id, service_id,
notification_id, notification_id,
encrypted_notification, encrypted_notification,
): ):
notification = encryption.decrypt(encrypted_notification) notification = encryption.decrypt(encrypted_notification)
@@ -536,8 +536,9 @@ def send_inbound_sms_to_service(self, inbound_sms_id, service_id):
response.raise_for_status() response.raise_for_status()
except RequestException as e: except RequestException as e:
current_app.logger.warning( current_app.logger.warning(
"send_inbound_sms_to_service request failed for service_id: {} and url: {}. exc: {}".format( "send_inbound_sms_to_service failed for service_id: {} for inbound_sms_id: {} and url: {}. exc: {}".format(
service_id, service_id,
inbound_sms_id,
inbound_api.url, inbound_api.url,
e e
) )
@@ -547,7 +548,9 @@ def send_inbound_sms_to_service(self, inbound_sms_id, service_id):
self.retry(queue=QueueNames.RETRY) self.retry(queue=QueueNames.RETRY)
except self.MaxRetriesExceededError: except self.MaxRetriesExceededError:
current_app.logger.error( current_app.logger.error(
'Retry: send_inbound_sms_to_service has retried the max number of times for inbound_sms {}'.format( """Retry: send_inbound_sms_to_service has retried the max number of
times for service: {} and inbound_sms {}""".format(
service_id,
inbound_sms_id inbound_sms_id
) )
) )
@@ -570,7 +573,6 @@ def process_incomplete_jobs(job_ids):
def process_incomplete_job(job_id): def process_incomplete_job(job_id):
job = dao_get_job_by_id(job_id) job = dao_get_job_by_id(job_id)
last_notification_added = dao_get_last_notification_added_for_job_id(job_id) last_notification_added = dao_get_last_notification_added_for_job_id(job_id)