8000 fix: Log site only if exists by gavindsouza · Pull Request #11182 · frappe/frappe · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: Log site only if exists #11182

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions frappe/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
3 changes: 2 additions & 1 deletion frappe/utils/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

# imports - module imports
import frappe
from frappe.utils import get_sites


default_log_level = logging.DEBUG
Expand All @@ -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
Expand Down
0