From 8a371301aca957122c0cd62a5076daff2de07a03 Mon Sep 17 00:00:00 2001 From: Kelvin Chan Date: Thu, 25 Jul 2024 16:07:09 -0400 Subject: [PATCH] Separate profiling middleware logs (#107) * Separate profiling middleware logs * Profiling logs will write to 'profiling' logger instead of the standard 'security.middleware' logger * Fix typo --- pyproject.toml | 2 +- security/middleware.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 4f60713..5c6c9c0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "django-security" -version = "1.0.1" +version = "1.0.2" homepage = "https://github.com/sdelements/django-security" description = "Models, views, middlewares and forms to facilitate security hardening of Django applications." authors = ["Security Compass "] diff --git a/security/middleware.py b/security/middleware.py index f5289ad..b984c0f 100644 --- a/security/middleware.py +++ b/security/middleware.py @@ -22,6 +22,8 @@ from ua_parser import user_agent_parser logger = logging.getLogger(__name__) +profiling_logger = logging.getLogger("profiling") + DJANGO_CLICKJACKING_MIDDLEWARE_URL = ( "https://docs.djangoproject.com/en/4.2/ref/clickjacking/" ) @@ -1212,6 +1214,6 @@ def __call__(self, request): out.write(self.format_queries_and_time_for_logs(queries)) out.write(self.request_separator) - logger.debug(out.getvalue()) + profiling_logger.debug(out.getvalue()) return response