diff --git a/radicale/app/base.py b/radicale/app/base.py index ac4a26bc..5c8a9355 100644 --- a/radicale/app/base.py +++ b/radicale/app/base.py @@ -51,6 +51,7 @@ class ApplicationBase: self._encoding = configuration.get("encoding", "request") self._log_bad_put_request_content = configuration.get("logging", "bad_put_request_content") self._response_content_on_debug = configuration.get("logging", "response_content_on_debug") + self._request_content_on_debug = configuration.get("logging", "request_content_on_debug") self._hook = hook.load(configuration) def _read_xml_request_body(self, environ: types.WSGIEnviron @@ -66,17 +67,20 @@ class ApplicationBase: logger.debug("Request content (Invalid XML):\n%s", content) raise RuntimeError("Failed to parse XML: %s" % e) from e if logger.isEnabledFor(logging.DEBUG): - logger.debug("Request content:\n%s", - xmlutils.pretty_xml(xml_content)) + if self._request_content_on_debug: + logger.debug("Request content (XML):\n%s", + xmlutils.pretty_xml(xml_content)) + else: + logger.debug("Request content (XML): suppressed by config/option [logging] request_content_on_debug") return xml_content def _xml_response(self, xml_content: ET.Element) -> bytes: if logger.isEnabledFor(logging.DEBUG): if self._response_content_on_debug: - logger.debug("Response content:\n%s", + logger.debug("Response content (XML):\n%s", xmlutils.pretty_xml(xml_content)) else: - logger.debug("Response content: suppressed by config/option [logging] response_content_on_debug") + logger.debug("Response content (XML): suppressed by config/option [logging] response_content_on_debug") f = io.BytesIO() ET.ElementTree(xml_content).write(f, encoding=self._encoding, xml_declaration=True)