Tuesday, December 3, 2019

Django - Python Command line is not showing the console messages



This is crazy that the python logger works via flush. To flush out the current buffer, below to be added in the code after the print statement

import sys
print("this is a sample console log");
sys.stdout.flush()

Sure there are some other easy way to do, but for time being this is a quick and dirty solution.

References
https://stackoverflow.com/questions/4558879/python-django-log-to-console-under-runserver-log-to-file-under-apache

No comments:

Post a Comment