Python doesn't print logs on Render.com

in Cloud & Serverless


When you deploy a Python Web Service to Render.com, your print statements may not work. They may appear later if they get buffered, but in most cases you want them to be put out immediately in the console.

Render logs everything output to STDOUT. So you’ll need to make sure you configure your logging library to output to STDOUT.

import logging
import sys

logging.basicConfig(level=logging.INFO, handlers=[logging.StreamHandler(sys.stdout)])

logging.info("hello world")

Sources:

#python #render-com