From 8b87fff9800273bdcf8b8366c98ab3fb495c44d5 Mon Sep 17 00:00:00 2001 From: WJH <40563566+loveclever@users.noreply.github.com> Date: Sun, 23 Apr 2023 10:47:24 +0800 Subject: [PATCH] improve log level when status is 1 and 4 (#5446) --- seahub/onlyoffice/views.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/seahub/onlyoffice/views.py b/seahub/onlyoffice/views.py index 63e8bce14f..90f26b7b87 100644 --- a/seahub/onlyoffice/views.py +++ b/seahub/onlyoffice/views.py @@ -103,9 +103,14 @@ def onlyoffice_editor_callback(request): doc_info = cache.get(doc_key) if not doc_info: - logger.error('status {}: can not get doc_info from cache by doc_key {}'.format(status, doc_key)) - logger.info(post_data) - return HttpResponse('{"error": 1}') + if status not in (1, 4): + logger.error('status {}: can not get doc_info from cache by doc_key {}, post_data: {}' + .format(status, doc_key, post_data)) + return HttpResponse('{"error": 1}') + else: + # if the status is 1 and 4, the log level should not be error + logger.info('status {}: can not get doc_info from database by doc_key {}'.format(status, doc_key)) + return HttpResponse('{"error": 1}') else: logger.info('status {}: get doc_info {} from cache by doc_key {}'.format(status, doc_info, doc_key))