Download Log from AppEngine Including Python Log Statements

后端 未结 4 475
眼角桃花
眼角桃花 2020-12-14 09:04

I know you can download the raw access logs with appcfg.py, but I\'m really interested in all the information around a specific request like python logging statements, excep

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-14 09:39

    This is what works for us really well:

    appcfg.py --append --num_days=0 --include_all request_logs /path/to/your/app/ /var/log/gae/yourapp.log
    

    Anyway, the line above will get all your log records and append them to a log file if you've executed this before, if not, it will create a new log file. It actually looks at your existing log (if it's there) and it will not get any duplicates. You can run this without --append if you want, but use it if you are automating log downloads.

    The key here is the --include_allflag which seems to be undocumented. This flag will get all the data that you see if you use GAE's web log viewer. So, you will get fields such as: ms=71 cpu_ms=32 api_cpu_ms=12 cpm_usd=0.000921... etc.

    OK, I hope that helps someone.

    BTW, we wrote up a blog post on this, check it out here.

提交回复
热议问题