Guardar registros de solicitud de django en un archivo
Frecuentes
Visto 950 equipos
1
Django shows the requests logs in command line, I want to save that logs in a file. I found a solución aquí but it saves the logs only that we print manually. Can we save all of the request and response logs in a separate file?
2 Respuestas
1
To log the Django request debug events, check out my answer aquí sobre el uso del falla-muy bien-django config. You will also get 4xx and 5xx request events logged from Django's default loggers.
Note, though, that 2xx requests generally don't get logged by Django, if that's what you are after (only runserver
shows them in the console). There is a workaround mentioned aquí, but you should generally use your server's access logs for these in production (e.g. acceso.log in nginx/Apache).
contestado el 23 de mayo de 17 a las 13:05
0
This should work on both linux and windows I hope:
python manage.py runserver > logs.txt
contestado el 28 de mayo de 14 a las 12:05
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas django python-2.7 logging or haz tu propia pregunta.