com.google.appengine.api.log

## 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 which the version(s) of the application for which logs should be retrieved. If `null`, logs for the version making the request will be returned.

  `serverVersions` specifies which the server version(s) of the application for which logs should be retrieved. If `null`, logs for the version making the request will be returned.

  `requestIds`, if not `null`, 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 will cause an exception, while unrecognized request IDs be ignored. This option may not be combined with any filtering options such as startTime, endTime, offset, or minLogLevel. majorVersionIds and serverVersions is ignored. IDs that do not correspond to a request log will be ignored. Logs will be 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())
           .includeIncomplete(true).minimumLogLevel(LogService.INFO));

  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `LogQuery.Builder` Contains static creation methods for `LogQuery`.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `LogQuery()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `LogQuery` | `batchSize(int batchSize)` Sets the batch size.
    `LogQuery` | `clone()` Makes a copy of a provided LogQuery.
    `LogQuery` | `endTimeMillis(long endTimeMillis)` Sets the end time to a value in milliseconds.
    `LogQuery` | `endTimeUsec(long endTimeUsec)` Sets the end time to a value in microseconds.
    `java.lang.Integer` | `getBatchSize()`
    `java.lang.Long` | `getEndTimeMillis()`
    `java.lang.Long` | `getEndTimeUsec()`
    `java.lang.Boolean` | `getIncludeAppLogs()`
    `java.lang.Boolean` | `getIncludeIncomplete()`
    `java.util.List<java.lang.String>` | `getMajorVersionIds()`
    `LogService.LogLevel` | `getMinLogLevel()`
    `java.lang.String` | `getOffset()`
    `java.util.List<java.lang.String>` | `getRequestIds()`
    `java.util.List<>` | `getServerVersions()`
    `java.lang.Long` | `getStartTimeMillis()`
    `java.lang.Long` | `getStartTimeUsec()`
    `LogQuery` | `includeAppLogs(boolean includeAppLogs)` Sets include application logs.
    `LogQuery` | `includeIncomplete(boolean includeIncomplete)` Sets include incomplete.
    `LogQuery` | `majorVersionIds(java.util.List<java.lang.String> versionIds)` Sets the major version identifiers to query.
    `LogQuery` | `minLogLevel(LogService.LogLevel minLogLevel)` Sets the minimum log level.
    `LogQuery` | `offset(java.lang.String offset)` Sets the offset.
    `LogQuery` | `requestIds(java.util.List<java.lang.String> requestIds)` Sets the list of request ids to query.
    `LogQuery` | `serverVersions(java.util.List<> serverVersions)` Sets the server and version identifiers to query.
    `LogQuery` | `startTimeMillis(long startTimeMillis)` Sets the start time to a value in milliseconds.
    `LogQuery` | `startTimeUsec(long startTimeUsec)` Sets the start time to a value in microseconds.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### LogQuery

          public LogQuery()

  - ### Method Detail

    - #### clone

          public LogQuery clone()

      Makes a copy of a provided LogQuery.
      Overrides:
        `clone` in class `java.lang.Object`
      Returns:
        A new LogQuery whose fields are copied from the given LogQuery.

    - #### offset

          public LogQuery offset(java.lang.String offset)

      Sets the offset. Please read the class javadoc for an explanation of how offset is used.
      Parameters:
        `offset` - The offset to set.
      Returns:
        `this` (for chaining)

    - #### startTimeMillis

          public LogQuery startTimeMillis(long startTimeMillis)

      Sets the start time to a value in milliseconds. Please read the class javadoc for an explanation of how start time is used.
      Parameters:
        `startTimeMillis` - The start time to set, in milliseconds.
      Returns:
        `this` (for chaining)

    - #### startTimeUsec

          public LogQuery startTimeUsec(long startTimeUsec)

      Sets the start time to a value in microseconds. Please read the class javadoc for an explanation of how start time is used.
      Parameters:
        `startTimeUsec` - The start time to set, in microseconds.
      Returns:
        `this` (for chaining)

    - #### endTimeMillis

          public LogQuery endTimeMillis(long endTimeMillis)

      Sets the end time to a value in milliseconds. Please read the class javadoc for an explanation of how end time is used.
      Parameters:
        `endTimeMillis` - The end time to set, in milliseconds.
      Returns:
        `this` (for chaining)

    - #### endTimeUsec

          public LogQuery endTimeUsec(long endTimeUsec)

      Sets the end time to a value in microseconds. Please read the class javadoc for an explanation of how end time is used.
      Parameters:
        `endTimeUsec` - The end time to set, in microseconds.
      Returns:
        `this` (for chaining)

    - #### batchSize

          public LogQuery batchSize(int batchSize)

      Sets the batch size. Please read the class javadoc for an explanation of how batch size is used.
      Parameters:
        `batchSize` - The batch size to set. Must be greater than 0.
      Returns:
        `this` (for chaining)

    - #### minLogLevel

          public LogQuery minLogLevel(LogService.LogLevel minLogLevel)

      Sets the minimum log level. Please read the class javadoc for an explanation of how minimum log level is used.
      Parameters:
        `minLogLevel` - The minimum log level to set.
      Returns:
        `this` (for chaining)

    - #### includeIncomplete

          public LogQuery includeIncomplete(boolean includeIncomplete)

      Sets include incomplete. Please read the class javadoc for an explanation of how include incomplete is used.
      Parameters:
        `includeIncomplete` - The value to set.
      Returns:
        `this` (for chaining)

    - #### includeAppLogs

          public LogQuery includeAppLogs(boolean includeAppLogs)

      Sets include application logs. Please read the class javadoc for an explanation of how include application logs is used.
      Parameters:
        `includeAppLogs` - The value to set.
      Returns:
        `this` (for chaining)

    - #### majorVersionIds

          public LogQuery majorVersionIds(java.util.List<java.lang.String> versionIds)

      Sets the major version identifiers to query. Please read the class javadoc for an explanation of how major versions are used.
      Parameters:
        `versionIds` - The major version identifier list to set.
      Returns:
        `this` (for chaining)

    - #### serverVersions

          public LogQuery serverVersions(java.util.List<> serverVersions)

      Sets the server and version identifiers to query. Please read the class javadoc for an explanation of how Servers and Versions are used.
      Parameters:
        `serverVersions` - The list of Servers and Versions to set.
      Returns:
        `this` (for chaining)

    - #### requestIds

          public LogQuery requestIds(java.util.List<java.lang.String> requestIds)

      Sets the list of request ids to query. See the class javadoc for an explanation of how request ids are used.
      Parameters:
        `requestIds` - The request id list to set.
      Returns:
        `this` (for chaining)

    - #### getOffset

          public java.lang.String getOffset()

      Returns:
        The offset, or `null` if none was provided.

    - #### getBatchSize

          public java.lang.Integer getBatchSize()

      Returns:
        The batch size, or `null` if none was provided.

    - #### getEndTimeMillis

          public java.lang.Long getEndTimeMillis()

      Returns:
        The end time in milliseconds, or `null` if none was provided.

    - #### getEndTimeUsec

          public java.lang.Long getEndTimeUsec()

      Returns:
        The end time in microseconds, or `null` if none was provided.

    - #### getIncludeAppLogs

          public java.lang.Boolean getIncludeAppLogs()

      Returns:
        Whether or not application logs should be returned.

    - #### getIncludeIncomplete

          public java.lang.Boolean getIncludeIncomplete()

      Returns:
        Whether or not incomplete request logs should be returned.

    - #### getMinLogLevel

          public LogService.LogLevel getMinLogLevel()

      Returns:
        The minimum log level, or `null` if none was provided.

    - #### getStartTimeMillis

          public java.lang.Long getStartTimeMillis()

      Returns:
        The start time in milliseconds, or `null` if none was provided.

    - #### getStartTimeUsec

          public java.lang.Long getStartTimeUsec()

      Returns:
        The start time in microseconds, or `null` if none was provided.

    - #### getMajorVersionIds

          public java.util.List<java.lang.String> getMajorVersionIds()

      Returns:
        The list of major app versions that should be queried over, or an empty list if none were set.

    - #### getServerVersions

          public java.util.List<> getServerVersions()

      Returns:
        The list of server versions for the application that should be queried over, or an empty list if none were set.

    - #### getRequestIds

          public java.util.List<java.lang.String> getRequestIds()

      Returns:
        The list of request ids that should be queried over, or `null` if none were set.