简体   繁体   English

如何从App Engine的Python Dev_server解码持久日志文件

[英]How to decode the persisted log files from App Engine's Python Dev_server

Using Google App Engine's local dev_server, one of the published options is to save the log files to disk. 使用Google App Engine的本地dev_server,已发布的选项之一是将日志文件保存到磁盘。

"If you wish to persist the logs from the development server to disk at a location of your own >choosing, supply the desired path and filename to the --logs_path command line option as follows: “如果您希望将日志从开发服务器保存到磁盘上自己选择的位置,请为--logs_path命令行选项提供所需的路径和文件名,如下所示:

dev_appserver.py --logs_path=your-path/your-logfile-name your-app-directory" dev_appserver.py --logs_path =您的路径/您的日志文件名“您的应用程序目录”

This works except the files are in a binary format I can't decode. 除了文件是我无法解码的二进制格式之外,此方法均有效。

Google published some sample code but this is intended for an app to read the production logs. Google发布了一些示例代码,但这是供应用程序读取生产日志使用的。

Is there a command line utlity or python script that can decode the log files stored by the dev_server? 是否有命令行工具或python脚本可以解码dev_server存储的日志文件? This was submitted as a feature request in 2011. 这是在2011年作为功能请求提交的。

I can see the logs in the PyDev console as they are produced, but once the current execution is restarted, those logs are gone from that console. 我可以在PyDev控制台中看到生成的日志,但是一旦重新启动当前执行,这些日志就会从该控制台中消失。

There are some suggestions to pipe the logfile unix style, but this does not help with the logs already stored. 有一些建议可以使用管道文件unix样式,但这对已经存储的日志没有帮助。

The logfile created is a SQLite database. 创建的日志文件是一个SQLite数据库。 Use the sqlite3 module to access it. 使用sqlite3模块进行访问。

The schema used is: 使用的架构是:

CREATE TABLE AppLogs (
  id INTEGER NOT NULL PRIMARY KEY,
  request_id INTEGER NOT NULL,
  timestamp INTEGER NOT NULL,
  level INTEGER NOT NULL,
  message TEXT NOT NULL,
  FOREIGN KEY(request_id) REFERENCES RequestLogs(id)
);
CREATE TABLE RequestLogs (
  id INTEGER NOT NULL PRIMARY KEY,
  user_request_id TEXT NOT NULL,
  app_id TEXT NOT NULL,
  version_id TEXT NOT NULL,
  module TEXT NOT NULL,
  ip TEXT NOT NULL,
  nickname TEXT NOT NULL,
  start_time INTEGER NOT NULL,
  end_time INTEGER DEFAULT 0 NOT NULL,
  method TEXT NOT NULL,
  resource TEXT NOT NULL,
  http_version TEXT NOT NULL,
  status INTEGER DEFAULT 0 NOT NULL,
  response_size INTEGER DEFAULT 0 NOT NULL,
  user_agent TEXT NOT NULL,
  url_map_entry TEXT DEFAULT '' NOT NULL,
  host TEXT NOT NULL,
  task_queue_name TEXT DEFAULT '' NOT NULL,
  task_name TEXT DEFAULT '' NOT NULL,
  latency INTEGER DEFAULT 0 NOT NULL,
  mcycles INTEGER DEFAULT 0 NOT NULL,
  finished INTEGER DEFAULT 0 NOT NULL
);

RequestLogs contains HTTP requests (from a browser or a task queue); RequestLogs包含HTTP请求(来自浏览器或任务队列); AppLogs contains any logging entries recorded during a specific request. AppLogs包含在特定请求期间记录的所有日志记录条目。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从命令行访问Google App Engine的开发服务器数据 - How to access Google App Engine's dev server data from the command line 如何从谷歌应用引擎开发应用服务器批量下载 - How to bulk download from google app engine dev app server Google云端存储客户端无法在本地dev_server上运行 - Google Cloud Storage Client not working on local dev_server GAE数据存储区在dev_server中正常运行,而不在生产环境中运行 - GAE datastore performs normally in dev_server, not in production 无法在dev_server上运行appengine-admin - cannot run appengine-admin on dev_server Python - 无法在本地应用引擎开发服务器中导入 bcrypt - Python - Can't import bcrypt in local app engine dev server 如何使用带有Python的Google App Engine开发服务器运行两个版本的应用程序 - How to run two versions of an application using Google App Engine dev server with Python 如何将 Python 3 与 Google App Engine 的本地开发服务器一起使用 - How to use Python 3 with Google App Engine's Local Development Server 如何在Python中解码Google App Engine实体密钥路径str? - How to decode a Google App Engine entity Key path str in Python? 如何在App Engine中解码JPG中的像素(使用纯Python)? - How to decode the pixels in a JPG in App Engine (using pure python)?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM