English ▼
Skip to page content Skip to main navigation
e.g. "templates" or "datastore"

# The RequestLog Class

This class is a representation of the complete log data available for a single request, including all application logs for that request.

`RequestLog` is provided by the `google.appengine.api.logservice` module.

- Introduction
- Properties
  - api_mcycles
  - app_id
  - app_logs
  - combined
  - cost
  - end_time
  - finished
  - host
  - http_version
  - instance_key
  - ip
  - latency
  - mcycles
  - method
  - nickname
  - offset
  - pending_time
  - referrer
  - replica_index
  - request_id
  - resource
  - response_size
  - start_time
  - status
  - task_name
  - task_queue_name
  - url_map_entry
  - user_agent
  - version_id
  - was_loading_request

## Introduction

A large set of log data is written during the handling of a request. The RequestLog class contains all of this data with the different types of data represented as properties. Because one or more application logs can be written during the handling of an incoming client request, there is a property containing a list of AppLog objects, each of which contains one application log.

You don't instantiate this class. Instead, you obtain this information by invoking logservice.fetch() to get the filtered list of `RequestLog` objects, each of which contains all the log information for that request, incuding application logs. You then get the list of AppLog objects from each RequestLog object using the `app_logs` property to return a list of AppLog objects. (This list can be empty, if no app log was written during the request.)

## Instance Properties

app_id
  Returns the application id of the application that handled the request as a string.
app_logs
  Returns a list of AppLog objects containing any log messages emitted by the application while serving this request, or an empty list if there were no application logs written.
api_mcycles
  The number of machine cycles spent in API calls while processing request (or None if not available) as a long.
combined
  Returns a string containing an Apache-style log line in the form documented at apache.org. This is the Apache combined log entry for request, which can be constructed from the rest of this message; however, this field is included for convenience.
cost
  Returns a float value representing the estimated cost of this request in fractional dollars or None if not available.
end_time
  Returns a float value representing the time at which the request completed expressed in seconds since the Unix epoch.
finished
  Returns a bool indicating whether this log represents a finished request.
host
  Returns a string containing the Internet host and port number of the resource being requested or None if not available.
http_version
  Returns a string containing the HTTP version used in the request.
instance_key
  Returns a string containing a mostly-unique identifier for the instance that handled the request, or None if not applicable.
ip
  Returns a string containing the origin IP address of the request.
latency
  Returns a float value representing the time required to process the request in seconds.
mcycles
  Returns an int value representing the number of machine cycles used to process the request.
method
  Returns a string containing the request method (GET, PUT, POST, etc).
nickname
  Returns a string containing the nickname of the user that made the request if known and logged-in or None otherwise.
offset
  Returns a bytestring containing the binary offset indicating the current position in the active result stream. This value may be submitted to subsequent `logservice.fetch()` requests (with all other parameters identical except for the offset) to continue reading logs starting immediately after this request.
pending_time
  Returns a float value representing the amount of time in seconds that this request spent in the pending request queue.
referrer
  Returns a string containing the Referrer URL of the request or None if not applicable.
replica_index
  Returns an int representing the server replica that handled the request, or None if not applicable.
request_id
  Returns a bytestring containing the globally unique identifier for a request, based on request start time. Request ids for requests that started later will compare greater as binary strings than those for requests which started earlier.
resource
  Returns a string containing the resource path on the server requested by the client (the path component of the request URL). For example, http://nowhere.com/app would have a resource string of '/app'.
response_size
  Returns a long value representing the size in bytes sent back to the client by the request.
start_time
  Returns a float value representing the time at which the request began processing expressed in seconds since the Unix epoch.
status
  Returns an int value representing the response status of the request.
task_name
  Returns a string containing the request's task name, if this generated via the Task Queue API, or None otherwise.
task_queue_name
  Returns a string containing the request's queue name, if generated via the Task Queue API, or None otherwise.
url_map_entry
  Returns a string containing the file or class within the URL mapping used for the request. Useful for tracking down the source code which was responsible for managing the request, especially for multiple-mapped handlers.
user_agent
  Returns a string containing the user agent used to make the request or None if not applicable.
version_id
  Returns a string containing the version of the application that handled the request.
was_loading_request
  Returns a bool indicating whether this request was a loading request for an instance.