Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)



The log package

import "appengine/log"

Introduction

Package log provides the means of querying an application's logs from within an App Engine application.

Example:

c := appengine.NewContext(r)
query := &log.Query{
    AppLogs:  true,
    Versions: []string{"1"},
}

for results := query.Run(c); ; {
    record, err := results.Next()
    if err == log.Done {
    	c.Infof("Done processing results")
    	break
    }
    if err != nil {
    	c.Errorf("Failed to retrieve next log: %v", err)
    	break
    }
    c.Infof("Saw record %v", record)
}

Index

Variables
type AppLog
type Query
func (params *Query) Run(c appengine.Context) *Result
type Record
type Result
func (qr *Result) Next() (*Record, error)

Variables

var Done = errors.New("log: query has no more results")

Done is returned when a query iteration has completed.

type AppLog

type AppLog struct {
    Time    time.Time
    Level   int
    Message string
}

AppLog represents a single application-level log.

type Query

type Query struct {
    // Start time specifies the earliest log to return (inclusive).
    StartTime time.Time

    // End time specifies the latest log to return (exclusive).
    EndTime time.Time

    // Offset specifies a position within the log stream to resume reading from,
    // and should come from a previously returned Record's field of the same name.
    Offset []byte

    // Incomplete controls whether active (incomplete) requests should be included.
    Incomplete bool

    // AppLogs indicates if application-level logs should be included.
    AppLogs bool

    // ApplyMinLevel indicates if MinLevel should be used to filter results.
    ApplyMinLevel bool

    // If ApplyMinLevel is true, only logs for requests with at least one
    // application log of MinLevel or higher will be returned.
    MinLevel int

    // The major version IDs whose logs should be retrieved.
    Versions []string

    // A list of requests to search for instead of a time-based scan. Cannot be
    // combined with filtering options such as StartTime, EndTime, Offset,
    // Incomplete, ApplyMinLevel, or Versions.
    RequestIDs []string
}

Query defines a logs query.

func (*Query) Run

func (params *Query) Run(c appengine.Context) *Result

Run starts a query for log records, which contain request and application level log information.

type Record

type Record struct {
    AppID            string
    VersionID        string
    RequestID        []byte
    IP               string
    Nickname         string
    AppEngineRelease string

    // The time when this request started.
    StartTime time.Time

    // The time when this request finished.
    EndTime time.Time

    // Opaque cursor into the result stream.
    Offset []byte

    // The time required to process the request.
    Latency     time.Duration
    MCycles     int64
    Method      string
    Resource    string
    HTTPVersion string
    Status      int32

    // The size of the request sent back to the client, in bytes.
    ResponseSize int64
    Referrer     string
    UserAgent    string
    URLMapEntry  string
    Combined     string
    Host         string

    // The estimated cost of this request, in dollars.
    Cost              float64
    TaskQueueName     string
    TaskName          string
    WasLoadingRequest bool
    PendingTime       time.Duration
    Finished          bool
    AppLogs           []AppLog

    // Mostly-unique identifier for the instance that handled the request if available.
    InstanceID string
}

Record contains all the information for a single web request.

type Result

type Result struct {
    // contains filtered or unexported fields
}

Result represents the result of a query.

func (*Result) Next

func (qr *Result) Next() (*Record, error)

Next returns the next log record,

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.