com.google.apphosting.api
Class ApiProxy.LogRecord
- java.lang.Object
-
- com.google.apphosting.api.ApiProxy.LogRecord
-
- Enclosing class:
- ApiProxy
public static final class ApiProxy.LogRecord extends java.lang.Object
LogRecord
represents a single apphosting log entry, including a Java-specific logging level, a timestamp in microseconds, and a message, which is a formatted string containing the rest of the logging information (e.g. class and line number information, the message itself, the stack trace for any exception associated with the log record, etc.).A StackTraceElement may be attached to track the origin of the original log message so it can be recorded in the log.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static class
ApiProxy.LogRecord.Level
-
Constructor Summary
Constructors Constructor and Description LogRecord(ApiProxy.LogRecord.Level level, long timestamp, java.lang.String message)
LogRecord(ApiProxy.LogRecord.Level level, long timestamp, java.lang.String message, java.lang.StackTraceElement stackFrame)
Constructor for when the source location will be extracted from a StackTraceElement.LogRecord(ApiProxy.LogRecord.Level level, long timestamp, java.lang.String message, java.lang.Throwable sourceLocation)
Deprecated.Prefer the constructor that takes a StackTraceElement to identify the source location.LogRecord(ApiProxy.LogRecord other, java.lang.String message)
A partial copy constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description ApiProxy.LogRecord.Level
getLevel()
java.lang.String
getMessage()
java.lang.Throwable
getSourceLocation()
java.lang.StackTraceElement
getStackFrame()
long
getTimestamp()
Returns the timestamp of the log message, in microseconds since midnight UTC on 1 January 1970.
-
-
-
Constructor Detail
-
LogRecord
public LogRecord(ApiProxy.LogRecord.Level level, long timestamp, java.lang.String message)
-
LogRecord
@Deprecated public LogRecord(ApiProxy.LogRecord.Level level, long timestamp, java.lang.String message, java.lang.Throwable sourceLocation)
Deprecated. Prefer the constructor that takes a StackTraceElement to identify the source location.Constructor for when the source location will be extracted from a Throwable.
-
LogRecord
public LogRecord(ApiProxy.LogRecord.Level level, long timestamp, java.lang.String message, java.lang.StackTraceElement stackFrame)
Constructor for when the source location will be extracted from a StackTraceElement.- Parameters:
level
- the log level.timestamp
- the log timestamp, in microseconds since midnight UTC on 1 January 1970.message
- the log message.stackFrame
- indicates the class name, method name, file name, and line number to be used in the log record. The source location is extracted from this object provided that the file name is not null and the line number is at least 1. Otherwise, the logging infrastructure may attempt to deduce the source location by finding a stack frame in the call stack matching the class and method fromstackFrame
.
-
LogRecord
public LogRecord(ApiProxy.LogRecord other, java.lang.String message)
A partial copy constructor.
-
-
Method Detail
-
getLevel
public ApiProxy.LogRecord.Level getLevel()
-
getTimestamp
public long getTimestamp()
Returns the timestamp of the log message, in microseconds since midnight UTC on 1 January 1970.
-
getMessage
public java.lang.String getMessage()
-
getSourceLocation
public java.lang.Throwable getSourceLocation()
-
getStackFrame
public java.lang.StackTraceElement getStackFrame()
-
-