fix: Log site only if exists

This commit is contained in:
Gavin D'souza 2020-08-03 17:23:32 +05:30
parent 9445c115ec
commit 4b93f75eba
2 changed files with 4 additions and 4 deletions

View file

@ -99,9 +99,8 @@ def application(request):
frappe.monitor.stop(response)
frappe.recorder.dump()
_site = get_site_name(request.host)
frappe.logger("frappe.web", allow_site=_site).info({
"site": _site,
frappe.logger("frappe.web", allow_site=frappe.local.site).info({
"site": get_site_name(request.host),
"remote_addr": getattr(request, "remote_addr", "NOTFOUND"),
"base_url": getattr(request, "base_url", "NOTFOUND"),
"full_path": getattr(request, "full_path", "NOTFOUND"),

View file

@ -11,6 +11,7 @@ from six import text_type
# imports - module imports
import frappe
from frappe.utils import get_sites
default_log_level = logging.DEBUG
@ -33,7 +34,7 @@ def get_logger(module=None, with_more_info=False, allow_site=True, filter=None,
if allow_site is True:
site = getattr(frappe.local, "site", None)
elif allow_site:
elif allow_site in get_sites():
site = allow_site
else:
site = False