How do I start a new logging session?

I have done some changes on the app code and want to see the log of the app after the changes.

The problem is that, even after closing and reopening the browser, or logging out and in in the app, the log keeps adding to an old session. I can’t use that old session because (1) it’s buried down in the log and I would always need to search for it and (2) it stopped logging and it says Further output not stored. To increase your logging limit, please contact support@anvil.works.

1 Like

You can use anvil.server.reset_session() found here:

But it does log you out, not a new logging session per say, but new session in general.

You could also open the app in an incognito tab in your browser. That also starts a new session.

I have tried that on the server and it throws an error.
I have tried it on the client, and it does nothing.
The app log keeps adding to the old session and I can’t see it.

1 Like

I have tried and it did start a new log session.
But then I tried again, and it keeps logging to the same session. Closing the incognito window, creating a new one and going to the same app does not create a new session.

Dang.

The only way I have done it, without being in a debug environment, is to open in a different browser.

Not very code friendly method, but will get you a new app session with the updates that you can follow along in your logs.

You mean the IDE in Chrome and the running app on Firefox?
I haven’t tried, but at this point I’m afraid it will do a new session only once, just like it does a new session only once with the incognito window (see Jay’s suggestion).

Waiting for a solution, I have added a Log table and I add to that table when I need to log something. Then I download the Log table to csv and browse it with Excel. It ain’t pretty (and I’m not marking this a solution, simply because it is not), but it allows me to work for now.

1 Like

Doesn’t have to be in the IDE, but yes one in chrome and one in another browser. However, It will only give you 1 new session and as soon as you make another update you’ll be stuck in the same loop.

1 Like

That’s bizarre. Cookies are supposed to be cleared when you close all the incognito windows, which should clear the session. When I run a test with a simple app that just prints something to the log, I’m seeing a new session when I close all incognito windows and then open a new incognito window.

I’ve seen similar things happen when there were other incognito windows/tabs open, as if they all shared some global state. Shutting down all of the browser’s incognito windows was required to clear the condition.

That is, the data were cleared not when the tab closed, but when the browser as a whole closed.

Ouch!

I did have another incognito window open, because I was working with two accounts of the same app.

This means that incognito windows are not really incognito, and that if I want to start a new logging session with an Anvil app, I need to close all sessions of all incognito windows.

Oh, well…

I noticed a while ago that incognito seems to operate as a session…which is, well, interesting…

Doing work on previous Anvil apps, I’ve found you do indeed have to close all the incognito tabs totally then kick it off again to get a fresh logging session.