Skip to content

Commit bfeb19a

Browse files
committed
Add auth debug logging configs
Signed-off-by: Kipchirchir Sigei <[email protected]>
1 parent 4ced17a commit bfeb19a

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

onadata/libs/authentication.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040
from onadata.libs.utils.common_tools import report_exception
4141
from onadata.libs.utils.email import get_account_lockout_email_data
4242

43-
logger = logging.getLogger("console_logger")
44-
logger.addHandler(logging.StreamHandler())
43+
logger = logging.getLogger(__name__)
44+
logger.addHandler(logging.FileHandler)
4545
logger.setLevel(logging.DEBUG)
4646

4747
ENKETO_AUTH_COOKIE = getattr(settings, "ENKETO_AUTH_COOKIE", "__enketo")

onadata/settings/common.py

+13
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,14 @@ def skip_suspicious_operations(record):
407407
"formatter": "verbose",
408408
"model": "onadata.apps.main.models.audit.AuditLog",
409409
},
410+
"file": {
411+
"class": "logging.handlers.RotatingFileHandler",
412+
"filename": "auth_debug.log",
413+
"backupCount": 10,
414+
"maxBytes": 1000000, # 1MB
415+
"formatter": "profiler",
416+
"level": "DEBUG",
417+
}
410418
# 'sql_handler': {
411419
# 'level': 'DEBUG',
412420
# 'class': 'logging.StreamHandler',
@@ -421,6 +429,11 @@ def skip_suspicious_operations(record):
421429
# }
422430
},
423431
"loggers": {
432+
"onadata.libs.authentication": {
433+
"handlers": ["file"],
434+
"level": "DEBUG",
435+
"propagate": True,
436+
},
424437
"django.request": {
425438
"handlers": ["mail_admins", "console"],
426439
"level": "DEBUG",

0 commit comments

Comments
 (0)