Skip to content

Commit 4756ebc

Browse files
committed
chore: configure casbin logger
1 parent 76c0a87 commit 4756ebc

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

openedx_authz/engine/enforcer.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,10 @@ def _initialize_enforcer(cls) -> SyncedEnforcer:
248248
# Avoid circular import
249249
from openedx_authz.engine.matcher import is_admin_or_superuser_check # pylint: disable=import-outside-toplevel
250250

251-
# Silence verbose casbin policy logging BEFORE creating the enforcer
252-
# to prevent print_policy() from showing during initialization
251+
# Configure logging BEFORE initialize_enforcer() because it creates a ProxyEnforcer
252+
# that doesn't pass logging config and would use Casbin's defaults
253253
logging.getLogger("casbin.policy").setLevel(logging.WARNING)
254+
logging.getLogger("casbin.role").setLevel(logging.WARNING)
254255

255256
db_alias = getattr(settings, "CASBIN_DB_ALIAS", "default")
256257

0 commit comments

Comments
 (0)