Logs apparently not working properly


I followed the Docs’ Python deployment tutorial to learn about Fly.

It worked and I modified the code a little bit to check how I would handle logs and environment variables.

So in addition to the original code, I just addded code to print: 1) the string passed to the route and 2) the environment variable “ENV_USER”.

import sys
from flask import Flask, render_template
import os

app = Flask(__name__)

def hello(name=None):
    print("[NAME]:", name, file=sys.stdout)
    print(os.getenv("ENV_USER", "STANDARD_USER"), file=sys.stdout)
    return render_template('hello.html', name=name)

The application is deployed and running without any error but its not working.

I am successfully requesting the endpoint but the info is not being logged as you can see in these images.
Screenshot from 2023-02-07 18-27-18

It works when I’m running the server locally, btw.

Anyone know what I’m doing wrong?

Thank you so much in advance :slight_smile:

1 Like