App logs not updating for published app

I’ve added some print statements to my app’s main form init in order to track some error I’ve been getting for a while.
When I look in the app log I see those print outs as expected. However when I publish the app, the published app works (I know because I see another feature I’ve added) but there are no entries in the app log. And indeed I only see DEBUG entries in the log. What gives?

(The last two weeks have not been pleasant with Anvil (which I usually love!)): a lot of weird errors, non functioning apps; apps that were unchanged by me and have been running for months).

Hi @mjmare,

I’ve not been able to reproduce this problem - when I publish a version of an app, logs show up for both debug and published sessions. Are you able to share a link to a minimal app that demonstrates the issue?

To my actual surprise I can reproduce it somewhat with a toy app.

https://anvil.works/build#clone:P2T4M6HPHP6SVVD3=5BRVBA73VDZXR42MUJORCWFL

Now, with this toy app, and refreshing like a maniac I do see some regular (=non debug) entries in the log. Debug log entries are instantaneous (though one sometimes has to click the refresh link in the green box). Regular don’t show or very much delayed(?).

I must say that it has forced me to take a good look at the log screen. Could entries be add to a ‘session’ with and old timestamp? So an event occurring at say 11:22 could be added to an entry showing 11:12? Looking at the screen there would be no way of knowing. That’s not good.

So at the very least there is a delay before entries show up. At least several minutes.
Secondly, it seems entries are added to existing sessions. If so, an additional timestamp would be useful.

I changed the demo ap to show timestamps. I can confirm that entries are added to existing sessions after what seems (see below) some delay.
This can be made more obvious by deleting all browser data (cookies etc) so that a new session is forced and the new session is at the top.

Also: the refresh button next to the search box seems to refresh the logs?! I never thought it did very much. So no green box (with “there are newer log entries”) now, but this button refreshes the logs. Closing and reopening the app log screen will not refresh the log entries, but this button will.

So my conclusion for now: user error due to non-intuitive log screen UI.

Learned something today.

Updated demo app: Anvil | Login

Hi @mjmare,

I’m glad that’s working for you. Anvil uses session cookies to associate visits with sessions in the logs. So if you go back to the same page, you will often find yourself in an existing session (if it hasn’t timed out since you were last there, which will take around 30min). The timestamp on the logs screen is for the start of the session - you can mouse-over any print output to see the precise time of that output.

To force a new session, you can either delete your cookies, open the app in a new Incognito window, or call anvil.server.reset_session() . You can read all about sessions in the docs.

1 Like

Ah, I missed the mouseover. Thx.

May I still suggest more consistent behaviour between debug sessions and production sessions? Ie the green refresh box. And also it would be useful to have the log screen refresh when reopened.