View in #prefect-community on Slack
@Muddassir_Shaikh: Logs not visible on UI , how to fix this ?
@Anna_Geller: Are you on Prefect Cloud? Normally, you should be able to refresh your browser page and see the logs then.
@Muddassir_Shaikh: No, hosted on personal server
@Anna_Geller: hmm could it be there is some issue with your Postgres instance running out of storage and not being able to store logs? checking logs could be informative
@Muddassir_Shaikh: do you know the path where this logs are stored ?
@Kevin_Kho: It’s a logs
table in the postgresdb
@Anna_Geller: @Muddassir_Shaikh what I meant that checking the Server logs would be useful to see If you see any error messages such as “no space left on Disk, couldn’t insert flow run logs to the DB”
@Muddassir_Shaikh: while setting up prefect, i didnt specify any database and installation was done automatic, can you guide me with the path of the postgresdb which it uses ?
@Kevin_Kho: If you do prefect server start
, it uses Docker compose to spin up multiple containers. There will be a postgres container which contains your Flows and metadata and logs
@Prateek_Saigal: @Kevin_Kho @Anna_Geller
We don’t see any server errors/postgres errors on the prefect server on the docker logs
Also do note that we are experiencing this for one of the agents - rest agents are fine - so don’t think it will be a space issue. What else could be the reason for this?
Also what set of username, password and database we should use if we have to connect to the postgresql ?
@Kevin_Kho: If you use prefect server start, it’s here
GitHub: server/config.toml at master · PrefectHQ/server
@Prateek_Saigal: okay can connect to the database and can see the log table but don’t see any logs from only one agent
@Kevin_Kho: You mean from the flows run on the agent? Or are you expecting agent logs to show up?
@Prateek_Saigal: I am expecting the logs of the flow runs on the agent
@Anna_Geller: To see flow run logs on the agent, you need to start your agent with a flag --show-flow-logs:
prefect agent local start --show-flow-logs
@Muddassir_Shaikh: @Anna_Geller i added showflow log flag still the logs are not visible on the UI. below is my agent startup command:
prefect agent local start -l my_agent_name -n my_agent_name -a <http://hosted_prefect_server_ip>:port -p /home/code/utils --show-flow-logs
@Anna_Geller: can you show the flow code of the flow that doesn’t generate logs properly?
if you use print, you need to add log_stdout=True to the task decorator, and to log from tasks, you need to use logger from the context:
@task
def do_sth():
logger = prefect.context.get("logger")
logger.info("some msg")
logging within flows is not supported in Prefect 1.0
@Muddassir_Shaikh: naah there is no issue in code as when i run the same code from different agent, logs are shown on UI. But i do see differences in prefect version of those agents
Solution
This is fixed now. The issue was with the prefect version. The prefect server had prefect version = 0.15.11 and this new agent had version=1.1.0. I downgraded it to 0.15.11 and now logs are visible on UI. Thanks, @Anna_Geller @Kevin_Kho @Prateek_Saigal for your time
@Anna_Geller: Great work finding and fixing the issue!