Bug: Again unable to search app logs

The app logs have been loading very fast for me recently and I can step through them (by clicking later/earlier) without issue.

However, as soon as I search for something they load forever and never return a result. The spinner appears but nothing more happens. This is the case both in the old and in the new IDE. My browser is Brave.

This makes them almost unusable to me as I have many sessions from different users.

It would be great to be able to download them all at once so I can search through them locally if the remote search is unreliable.

While I’m at it, there is another weird issue with the logs: Sometimes random new lines appear in the logs, for example:

This code:

print "Called show_affiliate_menu()"

…produces this log (notice the new line between “()”):

Called show_affiliate_menu(
)

Sometimes this even causes part of the logged data (the “)” in the picture below) to be pushed to a line that is marked as coming from a different source. The “)” actually comes from the server but is marked as coming from the client (blue line on the left):

image

Lastly, I also recall that sometimes the lines in a session log appear to be in the wrong order, but I don’t have a precise example at hand for this issue.

The search in the app log has worked for a short time after they refurbished the log system, then it stopped working: Searching in the app log is very slow

I have not been able to use it in months.

I gave up on the logging system. When I need to be able to search on logs, I add rows to a table instead of printing.

So sad :cry:

2 Likes

@stefano.menci can relate with your situation!
Recently had to search the logs to track down a defect and literally had to ask the customer to send us an image of the console. (Which is hard if your customers are not really technical people)

Has anyone experience with a good workaround to anvil logs? Or using a 3rd party solution?

@stucork Maybe you could give us a hint if it makes sense for us to try and build an anvil dependency that allows logging to a third party service.
I feel like a lot of anvil-users are hanging in the dry at the moment when it comes to searching the logs.
I don’t mind building this but I would not want to do a logging integration just a few weeks before a big update to the anvil logging system :sweat_smile:

(We are using Sentry.io for a flutter application.
Although I have no Idea how nice (or if it does at all) play with anvil)

1 Like

I created a Log table, I share it with all the apps that need logging, and each app adds to that table.

I also created a simple logger app that allows to filter the logs.
The logger app has an http endpoint that allows to log also from other non-Anvil tools.
The app uses the routing module from Anvil Extras, so I have shortcuts on the desktop that open the browser and show the filtered log.
There is a background task that deletes the old log entries and keeps only the latest 200,000.

1 Like

Smart move - thanks for sharing! Sounds like it works good for you.
But I feel like this could be just another thing you need to worry about as traffic scales up. :face_with_spiral_eyes:

I push all logs to a redis FIFO list, and I have a python script permanently running on a “far away” server that pops the data into sqlite or MySQL. Then via uplink I can query the logs.

This has the advantage that literally any of my apps (either Anvil, Freeswitch, SMS servers, whatever) can all log to the same place, and logs are created serially from a single process. Can do thousands of logs a second (actually that’s unmeasured, but it’s loads).

2 Likes

That’s discouraging to hear. Having a reliable logging system seems like a very elemental thing that should take priority over other, more advanced features in my opinion.

Tried searching the app logs again today and they seem to have improved! The search function actually returns something and while it does not return all of the logs entries that match my request at least it brings something back.

The new line issue is still there, though.

2 Likes

Yes, it works, yay!
From broken to working is an improvement indeed!

I don’t have any problems with entries containing "()":
image

1 Like

Nice indeed!

Let me try to illustrate the remaining issue with search that I encountered. Here I searched for a part (let’s say “test”) of an email address (“john_test@bla.com”). It is found but only one entry is displayed:

When I step through the logs manually, however, I find multiple instances of that very same email address which should also have been found, for example:

(Sorry for the red bars, you’ll have to take my word for it that it’s actually the same address. :joy: Happy to uncensored logs with mods via PN, of course!)

I remember in the olden days searching the log would return many false positives, especially when searching numbers. I think it was getting confused and would include matches also on other fields. But I was always able to find what I was looking for.

Have you tried using a longer string, for example the whole email address, searching for the same log entries?

Just did but now it doesn’t seem to find anything anymore. :frowning:

I really wish I could just download the whole logs so I can search through them locally.

2 Likes

The new line issue of the app logs seems to have been fixed. :slight_smile:

Search still seems to work only partially (same issue as described by me on Feb 14).

1 Like

I’m still struggling with exactly the issue described in the first post here. It’s extremely frustrating!

1 Like

After further testing, my guess is that when you do a search, it starts working on indexing all the logs. If it fails to complete that within a given amount of time it gives up and the search fails. Then if you search again it continues.

On several occasions I’ve found that I’m able to do a search only after multiple try-and-wait-for-ages cycles. After that’s happened, I’m then able to search freely and successfully.

My guess is that for those with less-busy logs, the system appears to work fine.

1 Like