LogQuery (Google App Engine API for Java)


Class LogQuery

  • java.lang.Object
    • com.google.appengine.api.log.LogQuery
  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable

    public final class LogQuery
    extends java.lang.Object
    implements java.lang.Cloneable, java.io.Serializable
    Allows users to customize the behavior of LogService.fetch(LogQuery).

    startTime is the earliest request completion or last-update time that results should be fetched for, in seconds since the Unix epoch. If null then no requests will be excluded for ending too long ago.

    endTime is the latest request completion or last-update time that results should be fetched for, in seconds since the Unix epoch. If null then no requests will be excluded for ending too recently.

    offset is a cursor into the log stream retrieved from a previously emitted RequestLogs.getOffset(). This iterator will begin returning logs immediately after the record from which the offset came. If null, the query will begin at startTime.

    minLogLevel is a LogService.LogLevel which serves as a filter on the requests returned. Requests with no application logs at or above the specified level will be omitted. Works even if includeAppLogs is not True.

    includeIncomplete selects whether requests that have started but not yet finished should be included in the query. Defaults to False.

    includeAppLogs specifies whether or not to include application logs in the query results. Defaults to False.

    majorVersionIds specifies versions of the application's default module for which logs records should retrieved.

    versions specifies module versions of the application for which logs should be retrieved.

    requestIds, if not empty(), indicates that instead of a time-based scan, logs for the specified requests should be returned. See the Request IDs section of the Java Servlet Environment documentation for how to retrieve these IDs at runtime. Malformed request IDs cause an exception and unrecognized request IDs are ignored. This option may not be combined with other filtering options such as startTime, endTime, offset, or minLogLevel. When requestIds is not empty(), majorVersionIds are ignored. Logs are returned in the order requested.

    batchSize specifies the internal batching strategy of the returned Iterable<RequestLogs>. Has no impact on the result of the query.

    Notes on usage:
    The recommended way to instantiate a LogQuery object is to statically import LogQuery.Builder.* and invoke a static creation method followed by an instance mutator (if needed):

     import static com.google.appengine.api.log.LogQuery.Builder.*;
     // All requests, including application logs.
     iter = logService.fetch(withIncludeAppLogs(true));
     // All requests ending in the past day (or still running) with an info log or higher.
     Calendar cal = Calendar.getInstance();
     cal.add(Calendar.DAY_OF_MONTH, -1);
     iter = logService.fetch(withEndTimeMillis(cal.time())
    There are a couple of ways to configure LogQuery to limit LogService.fetch(LogQuery) to only return log records for specific module versions.
    1. versions(List)(LogQuery.Builder.withVersions(List)) - Includes designated module versions for the application.
    2. majorVersionIds(List) (LogQuery.Builder.withMajorVersionIds(List)) - Includes designated versions of the default module for the application.
    For a particular LogQuery only one of these methods may be used. If neither is used, LogService.fetch(LogQuery) results may include any module version. It is not allowed to call both versions(List) (LogQuery.Builder.withVersions(List)) and requestIds(List)(LogQuery.Builder.withRequestIds(List) for the same LogQuery.
    See Also:
    Serialized Form
    • Constructor Detail

      • LogQuery

        public LogQuery()