# LogRecord

public class **LogRecord** extends [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)  
implements [Serializable](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/Serializable.html) LogRecord objects are used to pass logging requests between
the logging framework and individual log Handlers.


When a LogRecord is passed into the logging framework it
logically belongs to the framework and should no longer be
used or updated by the client application.


Note that if the client application has not specified an
explicit source method name and source class name, then the
LogRecord class will infer them automatically when they are
first accessed (due to a call on getSourceMethodName or
getSourceClassName) by analyzing the call stack. Therefore,
if a logging Handler wants to pass off a LogRecord to another
thread, or to transmit it over RMI, and if it wishes to subsequently
obtain method name or class name information it should call
one of getSourceClassName or getSourceMethodName to force
the values to be filled in.


**Serialization notes:**

- The LogRecord class is serializable.
- Because objects in the parameters array may not be serializable, during serialization all objects in the parameters array are written as the corresponding Strings (using Object.toString).
- The ResourceBundle is not transmitted as part of the serialized form, but the resource bundle name is, and the recipient object's readObject method will attempt to locate a suitable resource bundle.

<br />

### Public Constructor Summary

|---|---|
|   | [LogRecord](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/logging/LogRecord.html#LogRecord(java.util.logging.Level,%20java.lang.String))([Level](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/logging/Level.html) level, [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) msg) Construct a LogRecord with the given level and message values. |

### Public Method Summary

|---|---|
| [Level](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/logging/Level.html) | [getLevel](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/logging/LogRecord.html#getLevel())() Get the logging message level, for example Level.SEVERE. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getLoggerName](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/logging/LogRecord.html#getLoggerName())() Get the source Logger's name. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getMessage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/logging/LogRecord.html#getMessage())() Get the "raw" log message, before localization or formatting. |
| long | [getMillis](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/logging/LogRecord.html#getMillis())() Get event time in milliseconds since 1970. |
| [Object\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [getParameters](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/logging/LogRecord.html#getParameters())() Get the parameters to the log message. |
| [ResourceBundle](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/ResourceBundle.html) | [getResourceBundle](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/logging/LogRecord.html#getResourceBundle())() Get the localization resource bundle This is the ResourceBundle that should be used to localize the message string before formatting it. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getResourceBundleName](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/logging/LogRecord.html#getResourceBundleName())() Get the localization resource bundle name This is the name for the ResourceBundle that should be used to localize the message string before formatting it. |
| long | [getSequenceNumber](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/logging/LogRecord.html#getSequenceNumber())() Get the sequence number. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getSourceClassName](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/logging/LogRecord.html#getSourceClassName())() Get the name of the class that (allegedly) issued the logging request. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getSourceMethodName](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/logging/LogRecord.html#getSourceMethodName())() Get the name of the method that (allegedly) issued the logging request. |
| int | [getThreadID](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/logging/LogRecord.html#getThreadID())() Get an identifier for the thread where the message originated. |
| [Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) | [getThrown](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/logging/LogRecord.html#getThrown())() Get any throwable associated with the log record. |
| void | [setLevel](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/logging/LogRecord.html#setLevel(java.util.logging.Level))([Level](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/logging/Level.html) level) Set the logging message level, for example Level.SEVERE. |
| void | [setLoggerName](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/logging/LogRecord.html#setLoggerName(java.lang.String))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) name) Set the source Logger's name. |
| void | [setMessage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/logging/LogRecord.html#setMessage(java.lang.String))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) message) Set the "raw" log message, before localization or formatting. |
| void | [setMillis](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/logging/LogRecord.html#setMillis(long))(long millis) Set event time. |
| void | [setParameters](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/logging/LogRecord.html#setParameters(java.lang.Object[]))([Object\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) parameters) Set the parameters to the log message. |
| void | [setResourceBundle](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/logging/LogRecord.html#setResourceBundle(java.util.ResourceBundle))([ResourceBundle](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/ResourceBundle.html) bundle) Set the localization resource bundle. |
| void | [setResourceBundleName](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/logging/LogRecord.html#setResourceBundleName(java.lang.String))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) name) Set the localization resource bundle name. |
| void | [setSequenceNumber](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/logging/LogRecord.html#setSequenceNumber(long))(long seq) Set the sequence number. |
| void | [setSourceClassName](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/logging/LogRecord.html#setSourceClassName(java.lang.String))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) sourceClassName) Set the name of the class that (allegedly) issued the logging request. |
| void | [setSourceMethodName](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/logging/LogRecord.html#setSourceMethodName(java.lang.String))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) sourceMethodName) Set the name of the method that (allegedly) issued the logging request. |
| void | [setThreadID](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/logging/LogRecord.html#setThreadID(int))(int threadID) Set an identifier for the thread where the message originated. |
| void | [setThrown](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/logging/LogRecord.html#setThrown(java.lang.Throwable))([Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) thrown) Set a throwable associated with the log event. |

### Inherited Method Summary

From class [java.lang.Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)

|---|---|
| [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [clone](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#clone())() Creates and returns a copy of this `Object`. |
| boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) obj) Compares this instance with the specified object and indicates if they are equal. |
| void | [finalize](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#finalize())() Invoked when the garbage collector has detected that this instance is no longer reachable. |
| final [Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> | [getClass](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#getClass())() Returns the unique instance of `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html` that represents this object's class. |
| int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#hashCode())() Returns an integer hash code for this object. |
| final void | [notify](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notify())() Causes a thread which is waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| final void | [notifyAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notifyAll())() Causes all threads which are waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#toString())() Returns a string containing a concise, human-readable description of this object. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long,%20int))(long timeout, int nanos) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long))(long timeout) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait())() Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object. |

## Public Constructors

#### public
**LogRecord**
([Level](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/logging/Level.html) level, [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) msg)

Construct a LogRecord with the given level and message values.


The sequence property will be initialized with a new unique value.
These sequence values are allocated in increasing order within a VM.


The millis property will be initialized to the current time.


The thread ID property will be initialized with a unique ID for
the current thread.


All other properties will be initialized to "null".

##### Parameters

| level | a logging level value |
| msg | the raw non-localized logging message (may be null) |
|---|---|

## Public Methods

#### public [Level](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/logging/Level.html)
**getLevel**
()

Get the logging message level, for example Level.SEVERE.

##### Returns

- the logging message level

#### public [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**getLoggerName**
()

Get the source Logger's name.

##### Returns

- source logger name (may be null)

#### public [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**getMessage**
()

Get the "raw" log message, before localization or formatting.


May be null, which is equivalent to the empty string "".


This message may be either the final text or a localization key.


During formatting, if the source logger has a localization
ResourceBundle and if that ResourceBundle has an entry for
this message string, then the message string is replaced
with the localized value.

##### Returns

- the raw message string

#### public long
**getMillis**
()

Get event time in milliseconds since 1970.

##### Returns

- event time in millis since 1970

#### public [Object\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)
**getParameters**
()

Get the parameters to the log message.

##### Returns

- the log message parameters. May be null if there are no parameters.

#### public [ResourceBundle](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/ResourceBundle.html)
**getResourceBundle**
()

Get the localization resource bundle


This is the ResourceBundle that should be used to localize
the message string before formatting it. The result may
be null if the message is not localizable, or if no suitable
ResourceBundle is available.

##### Returns

- the localization resource bundle

#### public [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**getResourceBundleName**
()

Get the localization resource bundle name


This is the name for the ResourceBundle that should be
used to localize the message string before formatting it.
The result may be null if the message is not localizable.

##### Returns

- the localization resource bundle name

#### public long
**getSequenceNumber**
()

Get the sequence number.


Sequence numbers are normally assigned in the LogRecord
constructor, which assigns unique sequence numbers to
each new LogRecord in increasing order.

##### Returns

- the sequence number

#### public [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**getSourceClassName**
()

Get the name of the class that (allegedly) issued the logging request.


Note that this sourceClassName is not verified and may be spoofed.
This information may either have been provided as part of the
logging call, or it may have been inferred automatically by the
logging framework. In the latter case, the information may only
be approximate and may in fact describe an earlier call on the
stack frame.


May be null if no information could be obtained.

##### Returns

- the source class name

#### public [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**getSourceMethodName**
()

Get the name of the method that (allegedly) issued the logging request.


Note that this sourceMethodName is not verified and may be spoofed.
This information may either have been provided as part of the
logging call, or it may have been inferred automatically by the
logging framework. In the latter case, the information may only
be approximate and may in fact describe an earlier call on the
stack frame.


May be null if no information could be obtained.

##### Returns

- the source method name

#### public int
**getThreadID**
()

Get an identifier for the thread where the message originated.


This is a thread identifier within the Java VM and may or
may not map to any operating system ID.

##### Returns

- thread ID

#### public [Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html)
**getThrown**
()

Get any throwable associated with the log record.


If the event involved an exception, this will be the
exception object. Otherwise null.

##### Returns

- a throwable

#### public void
**setLevel**
([Level](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/logging/Level.html) level)

Set the logging message level, for example Level.SEVERE.

##### Parameters

| level | the logging message level |
|---|---|

#### public void
**setLoggerName**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) name)

Set the source Logger's name.

##### Parameters

| name | the source logger name (may be null) |
|---|---|

#### public void
**setMessage**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) message)

Set the "raw" log message, before localization or formatting.

##### Parameters

| message | the raw message string (may be null) |
|---|---|

#### public void
**setMillis**
(long millis)

Set event time.

##### Parameters

| millis | event time in millis since 1970 |
|---|---|

#### public void
**setParameters**
([Object\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) parameters)

Set the parameters to the log message.

##### Parameters

| parameters | the log message parameters. (may be null) |
|---|---|

#### public void
**setResourceBundle**
([ResourceBundle](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/ResourceBundle.html) bundle)

Set the localization resource bundle.

##### Parameters

| bundle | localization bundle (may be null) |
|---|---|

#### public void
**setResourceBundleName**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) name)

Set the localization resource bundle name.

##### Parameters

| name | localization bundle name (may be null) |
|---|---|

#### public void
**setSequenceNumber**
(long seq)

Set the sequence number.


Sequence numbers are normally assigned in the LogRecord constructor,
so it should not normally be necessary to use this method.

##### Parameters

| seq | the sequence number |
|---|---|

#### public void
**setSourceClassName**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) sourceClassName)

Set the name of the class that (allegedly) issued the logging request.

##### Parameters

| sourceClassName | the source class name (may be null) |
|---|---|

#### public void
**setSourceMethodName**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) sourceMethodName)

Set the name of the method that (allegedly) issued the logging request.

##### Parameters

| sourceMethodName | the source method name (may be null) |
|---|---|

#### public void
**setThreadID**
(int threadID)

Set an identifier for the thread where the message originated.

##### Parameters

| threadID | the thread ID |
|---|---|

#### public void
**setThrown**
([Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) thrown)

Set a throwable associated with the log event.

##### Parameters

| thrown | a throwable (may be null) |
|---|---|