diff --git a/setup/doctype/backup_manager/backup_googledrive.py b/setup/doctype/backup_manager/backup_googledrive.py index 24cd857667..7d980debe7 100644 --- a/setup/doctype/backup_manager/backup_googledrive.py +++ b/setup/doctype/backup_manager/backup_googledrive.py @@ -21,6 +21,11 @@ from webnotes import _, msgprint from apiclient.discovery import build from apiclient.http import MediaFileUpload +# define log config for google drive api's log messages +# basicConfig redirects log to stderr +import logging +logging.basicConfig() + @webnotes.whitelist() def get_gdrive_authorize_url(): flow = get_gdrive_flow() @@ -31,9 +36,6 @@ def get_gdrive_authorize_url(): @webnotes.whitelist() def upload_files(name, mimetype, service, folder_id): - import logging - logging.basicConfig() - if not webnotes.conn: webnotes.connect() file_name = os.path.basename(name) diff --git a/setup/doctype/backup_manager/backup_manager.py b/setup/doctype/backup_manager/backup_manager.py index feeddf035e..a8ecd636db 100644 --- a/setup/doctype/backup_manager/backup_manager.py +++ b/setup/doctype/backup_manager/backup_manager.py @@ -33,7 +33,8 @@ def take_backups_dropbox(): send_email(True, "Dropbox") except Exception: - error_message = ("\n".join(error_log) + "\n" + webnotes.getTraceback()) + file_and_error = [" - ".join(f) for f in zip(did_not_upload, error_log)] + error_message = ("\n".join(file_and_error) + "\n" + webnotes.getTraceback()) print error_message send_email(False, "Dropbox", error_message) @@ -48,7 +49,8 @@ def take_backups_gdrive(): send_email(True, "Google Drive") except Exception: - error_message = ("\n".join(error_log) + "\n" + webnotes.getTraceback()) + file_and_error = [" - ".join(f) for f in zip(did_not_upload, error_log)] + error_message = ("\n".join(file_and_error) + "\n" + webnotes.getTraceback()) print error_message send_email(False, "Google Drive", error_message)