无法使用appengine / log查找日志

I have this code:

// main.go
package magnum

import (
    "net/http"

    "google.golang.org/appengine"
    "google.golang.org/appengine/log"
)

func init() {
    http.HandleFunc("/tasks/backup", handler)
}

func handler(w http.ResponseWriter, r *http.Request) {
    ctx := appengine.NewContext(r)
    log.Debugf(ctx, "Testing cron tasks using Go")
}

// cron.yaml
cron:
- description: extraction
  url: /tasks/backup
  schedule: every 5 minutes

And I'm not seeing "Testing cron tasks using Go" text when I check the logs on GAE dashboard. Facts:

  • Locally, I can see that text when I test the cron task using development environment
  • On deployed, I can see a successful request on GAE dashboard when task is performed
  • Standar Environment

What could I be missing?

I believe the local development server doesn't by default display logged messages, try starting your local development server with this additional argument:

dev_appserver.py --log_level=info

You can also pass the --logs_path=... argument if you want to log the output to a file in addition to the console. Depending on the amount of logging you need to do that might be useful as well.

For your deployed application, you can find your logged application messages in the Logging section of the Cloud Platform Console. If you don't see them ensure that the drop-down filter has GAE Application selected.