diff --git a/authentik/lib/expression/evaluator.py b/authentik/lib/expression/evaluator.py index 902073a18..33f0ca81d 100644 --- a/authentik/lib/expression/evaluator.py +++ b/authentik/lib/expression/evaluator.py @@ -42,7 +42,7 @@ class BaseEvaluator: "ak_user_by": BaseEvaluator.expr_user_by, "ak_user_has_authenticator": BaseEvaluator.expr_func_user_has_authenticator, "ak_create_event": self.expr_event_create, - "ak_logger": get_logger(self._filename), + "ak_logger": get_logger(self._filename).bind(), "requests": get_http_session(), "ip_address": ip_address, "ip_network": ip_network, diff --git a/authentik/policies/process.py b/authentik/policies/process.py index c28ff50bf..90be043dd 100644 --- a/authentik/policies/process.py +++ b/authentik/policies/process.py @@ -101,12 +101,14 @@ class PolicyProcess(PROCESS_CLASS): LOGGER.debug("P_ENG(proc): error", exc=src_exc) policy_result = PolicyResult(False, str(src_exc)) policy_result.source_binding = self.binding - if self.request.should_cache: + should_cache = self.request.should_cache + if should_cache: key = cache_key(self.binding, self.request) cache.set(key, policy_result, CACHE_TIMEOUT) LOGGER.debug( - "P_ENG(proc): finished and cached ", + "P_ENG(proc): finished", policy=self.binding.policy, + cached=should_cache, result=policy_result, # this is used for filtering in access checking where logs are sent to the admin process="PolicyProcess",