如何从AppEngine下载日志,包括Python日志?

内容来源于 Stack Overflow,并遵循CC BY-SA 3.0许可协议进行翻译与使用

  • 回答 (2)
  • 关注 (0)
  • 查看 (72)

我知道可以用appcfg.py下载日志,但是我真的很感兴趣的是关于python如何得到?

提问于
用户回答回答于

只需将--severity传递给appcfg.py即可:

$ appcfg.py help request_logs
Usage: appcfg.py [options] request_logs <directory> <output_file>

Write request logs in Apache common log format.

The 'request_logs' command exports the request logs from your application
to a file.  It will write Apache common log format records ordered
chronologically.  If output file is '-' stdout will be written.

Options:
  -h, --help            Show the help message and exit.
  -q, --quiet           Print errors only.
  -v, --verbose         Print info level logs.
  --noisy               Print all logs.
  -s SERVER, --server=SERVER
                        The server to connect to.
  --insecure            Use HTTP when communicating with the server.
  -e EMAIL, --email=EMAIL
                        The username to use. Will prompt if omitted.
  -H HOST, --host=HOST  Overrides the Host header sent with all RPCs.
  --no_cookies          Do not save authentication cookies to local disk.
  --passin              Read the login password from stdin.
  -A APP_ID, --application=APP_ID
                        Override application from app.yaml file.
  -V VERSION, --version=VERSION
                        Override (major) version from app.yaml file.
  -n NUM_DAYS, --num_days=NUM_DAYS
                        Number of days worth of log data to get. The cut-off
                        point is midnight UTC. Use 0 to get all available
                        logs. Default is 1, unless --append is also given;
                        then the default is 0.
  -a, --append          Append to existing file.
  --severity=SEVERITY   Severity of app-level log messages to get. The range
                        is 0 (DEBUG) through 4 (CRITICAL). If omitted, only
                        request logs are returned.
  --vhost=VHOST         The virtual host of log messages to get. If omitted,
                        all log messages are returned.
  --include_vhost       Include virtual host in log messages.
  --end_date=END_DATE   End date (as YYYY-MM-DD) of period for log data.
                        Defaults to today.
用户回答回答于

看这个

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

我在国外找到的一篇博客文章,看这里:http : //bit.ly/GAE-LOGS

扫码关注云+社区

领取腾讯云代金券