Forums

logging error flooding system log: cannot view/access log file or trace problem

I am having the same issue as recorded here: https://www.pythonanywhere.com/forums/topic/31462/

My django project deploys views and pages fine, but I am having an issue accessing the system log because of a logging error consuming all memory when reading it. I planned on restarting my server and viewing the log files after to find out if it stops on a cold boot. If it doesn't stop flooding, it means there is something wrong in the django startup code and initialization that is messing with the logging handler.

After a cold boot I still can't open the log file. I tried commenting everything out in the wsgi.py script and redeploying since that has the only get_wsgi_application() call inside my project. This didn't seem to make a difference. I don't know if the logging issue is still persisting or not because I can't even read my logs.

What can I do to diagnose this issue?

I can right click the hyperlink and download the log. After downloading the massive 3gb log file I scrolled to the bottom and found it was initializing the server correctly after commenting out some code that called django.setup(). I needed to call this because I am launching a subprocess from a shell window and django resources need to be re-initialized for that environment to query the database.

What is the relation between your web app ant the code that you run in the shell, and why do you need that extra call to django.setup() that breaks your logging? Normally, when you need to run something in a shell, you write custom management command and that way all the Django stuff is handled.