Randy L
Randy L

Reputation: 14736

Something Wrong with App Engine Logpoints?

I really like the debug and logging features you get when using App Engine. It's incredibly useful to be able to set a breakpoint in your live code and inspect things when a problem arises. But it would be great if I could also go into live code and add logging statements.

This is what Logpoints are supposed to do, but I cannot get them to work. I am using a "traditional" App Engine project, written in Python using webapp2. I try to setup my logpoint using gcloud like this: gcloud debug logpoints create handlers/main.py:108 --target=my-service "I made this!". It gives me a success message and an URL where I can watch the logs.

Then I go into my source and set a breakpoint on the live code, at the very same line which my snippet above indicates. The breakpoint stops there, but there is no logging happening. I confirmed that the logpoint is setup with gcloud debug logpoints list and it's there. Just no logs. What am I missing? Anybody else have success using this?

Upvotes: 2

Views: 171

Answers (1)

Mar Cial R
Mar Cial R

Reputation: 946

I've just tested it (deployed a webapp GAE app, gcloud debug logpoints create, Stackdriver Debug>create snapshot...) and for me, the logpoint message is shown both in:

  • Cloud Logging: using the selectors for the right service / version
  • the small Logs tab at the bottom of StackDriver Debug UI after clicking on "Load more".

What I've noticed though, and I believe it is what is causing your issue, is that when i use the proposed logViewUrl printed after executing gcloud debug logpoints create..., the advanced log filter has an incorrect module_id:

resource.labels.module_id="None"

Depending on where you've deployed your app, the correct module_id could be different, but in my case, changing "None" to "default" fixed this logViewUrl issue.

Note: module and service are the same thing in this context

Upvotes: 1

Related Questions