Skip to content

Commit

Permalink
Add auth debug logging configs
Browse files Browse the repository at this point in the history
Signed-off-by: Kipchirchir Sigei <[email protected]>
  • Loading branch information
KipSigei committed Sep 26, 2023
1 parent 4ced17a commit 541a978
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
3 changes: 1 addition & 2 deletions onadata/libs/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@
from onadata.libs.utils.common_tools import report_exception
from onadata.libs.utils.email import get_account_lockout_email_data

logger = logging.getLogger("console_logger")
logger.addHandler(logging.StreamHandler())
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)

ENKETO_AUTH_COOKIE = getattr(settings, "ENKETO_AUTH_COOKIE", "__enketo")
Expand Down
13 changes: 13 additions & 0 deletions onadata/settings/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,14 @@ def skip_suspicious_operations(record):
"formatter": "verbose",
"model": "onadata.apps.main.models.audit.AuditLog",
},
"file": {
"class": "logging.handlers.RotatingFileHandler",
"filename": "auth_debug.log",
"backupCount": 5, # Number of backup files to keep
"maxBytes": 1024 * 1024 * 5, # 5MB
"formatter": "profiler",
"level": "DEBUG",
}
# 'sql_handler': {
# 'level': 'DEBUG',
# 'class': 'logging.StreamHandler',
Expand All @@ -421,6 +429,11 @@ def skip_suspicious_operations(record):
# }
},
"loggers": {
"onadata.libs.authentication": {
"handlers": ["file"],
"level": "DEBUG",
"propagate": True,
},
"django.request": {
"handlers": ["mail_admins", "console"],
"level": "DEBUG",
Expand Down

0 comments on commit 541a978

Please sign in to comment.