Logging CSRF errors and other HTTP errors by Django

19 views
Skip to first unread message

Web Architect

unread,
Mar 8, 2017, 9:15:42 AM3/8/17
to Django users
Hi,

Is there a way to log CSRF errors? Like whenever an user visits my site and faces a CSRF error, I would like Django to log it in a file. I would like to know if my users are facing CSRF errors. 
Also, Can Django log HTTP error codes like 4xx or 5xx in a file? 

We are using Django 1.8.3 with uWsgi.

Thanks.

Melvyn Sopacua

unread,
Mar 8, 2017, 11:01:21 AM3/8/17
to django...@googlegroups.com

On Wednesday 08 March 2017 06:15:42 Web Architect wrote:

 

> Is there a way to log CSRF errors? Like whenever an user visits my

> site and faces a CSRF error, I would like Django to log it in a file.

 

Did you read the logging documentation?

 

--

Melvyn Sopacua

Web Architect

unread,
Mar 9, 2017, 2:43:53 AM3/9/17
to Django users
Thanks for your response. We do use logging but missed the part of django.request. Thanks for pointing it. 
Reply all
Reply to author
Forward
0 new messages