简体   繁体   English

阻止App Engine记录客户端文件请求

[英]Prevent App Engine from logging client file requests

I'm working on an App Engine project in java. 我正在用Java开发App Engine项目。 I have an index.html and some .js and .css files in the war directory. 我在war目录中有一个index.html以及一些.js和.css文件。 Everytime the files in the war directory are accessed, it is logged. 每次访问war目录中的文件时,都会对其进行记录。 So I have tons of log entries which are just saying these files were accessed, but the only thing I'm interested in is the calls to my API. 因此,我有大量的日志条目,它们只是说已访问了这些文件,但我唯一感兴趣的是对我的API的调用。 Is there a way I can turn off logging of these client side files? 有没有办法关闭这些客户端文件的日志记录?

Request logs are a service provided by the platform. 请求日志是平台提供的服务。 You have no control over what requests get logged, you can only control the maximum size of all logs and the max age of log records (on the Application Settings page of the Admin Console). 您无法控制记录什么请求,只能控制所有日志的最大大小和日志记录的最长期限(在管理控制台的“应用程序设置”页面上)。

Actually, all requests get logged - even the cron and task queue requests. 实际上,所有请求都被记录-甚至是cron和任务队列请求。 What you can do is filter the displayed logs or the queried records if you use the Logs API. 如果使用Logs API,您可以做的是过滤显示的日志或查询的记录。 The full list of log properties can be viewed here . 日志属性的完整列表可以在此处查看。

There are log properties based on which you can tell if the request was targeted a static resource file, eg the instance on the log page or RequestLogs.getInstanceKey() in the API. 有一些日志属性,您可以根据这些属性来确定请求是否针对静态资源文件,例如,日志页面上的instance或API中的RequestLogs.getInstanceKey() Static file contents are not served by the instances of your application but by dedicated Google servers so in these cases there is no instance key while requests served by Servlet s for example will have an instance key. 静态文件内容不是由应用程序的实例提供的,而是由专用的Google服务器提供的,因此在这些情况下,没有实例密钥,而由Servlet服务的请求将具有实例密钥。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM