1👍
✅
The standard logging module provides all you need – in this case, logger.exception()
:
import logging
logger = logging.getLogger("your-logger-name")
def Set(request):
if request.method == "POST":
try:
#something nearly impossible
except Exception as exc:
#where do I log this?
logger.exception("some exception message")
Then you just have to properly configure your logger in your settings.py
as documented in Django’s FineManual(tm).
Source:stackexchange.com