<@ULVA73B9P> I am running this code: ```import h...
# ask-marvin
c
@Marvin I am running this code:
Copy code
import httpx
from prefect import flow


@flow()
def fetch_weather(lat: float = 38.9, lon: float = -77.0):
    base_url = "<https://api.open-meteo.com/v1/forecast/>"
    temps = httpx.get(
        base_url,
        params=dict(latitude=lat, longitude=lon, hourly="temperature_2m"),
    )
    forecasted_temp = float(temps.json()["hourly"]["temperature_2m"][0])
    print(f"Forecasted temp C: {forecasted_temp} degrees")
    return forecasted_temp


if __name__ == "__main__":
    fetch_weather.serve(name="deploy-1")
But on the UI Logs I dont see any printing of the forecasted
m
To get your logs to appear in the Prefect UI, you'll need to ensure proper logging within your flow. It looks like you're currently using
print
statements, but Prefect utilizes its own logging system. Here's how you can adjust your code: 1. Use Prefect's
get_run_logger
for logging within your flow. 2. Ensure that logging is configured correctly. Here is an example adjustment to your code:
Copy code
python
import httpx
from prefect import flow, get_run_logger

@flow()
def fetch_weather(lat: float = 38.9, lon: float = -77.0):
    logger = get_run_logger()
    base_url = "<https://api.open-meteo.com/v1/forecast/>"
    temps = httpx.get(
        base_url,
        params=dict(latitude=lat, longitude=lon, hourly="temperature_2m"),
    )
    forecasted_temp = float(temps.json()["hourly"]["temperature_2m"][0])
    <http://logger.info|logger.info>(f"Forecasted temp C: {forecasted_temp} degrees")
    return forecasted_temp

if __name__ == "__main__":
    fetch_weather.serve(name="deploy-1")
This will use Prefect's logging system and should ensure that logs appear in the UI. If you're still facing issues, you might need to check your logging configurations or consult these references: - Connecting &amp; Troubleshooting Prefect Cloud - Creating Interactive Workflows with Prefect - Logging in Prefect For specific issues, you might also find useful insights in related GitHub issues like: - No logs shown after upgrading - Prefect Cloud not receiving logs If the problem persists, consider checking your Prefect server and client versions as compatibility issues might cause logging problems.