douyi9597 2017-03-11 14:39
浏览 24

无法使用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?

  • 写回答

1条回答 默认 最新

  • du9757 2017-03-11 22:55
    关注

    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.

    评论

报告相同问题?

悬赏问题

  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程