加载中...
The Wayback Machine - https://sup1a9wrlpyh5li9ro.vcoronado.top/web/20090330062035/http://developer.android.com:80/reference/java/util/logging/LogRecord.html
public class

LogRecord

extends Object
implements Serializable
java.lang.Object
   ↳ java.util.logging.LogRecord

Class Overview

A LogRecord object represents a logging request. It is passed between the logging framework and individual logging handlers. Client applications should not modify a LogRecord object that has been passed into the logging framework.

The LogRecord class will infer the source method name and source class name the first time they are accessed if the client application didn't specify them explicitly. This automatic inference is based on the analysis of the call stack and is not guaranteed to be precise. Client applications should force the initialization of these two fields by calling getSourceClassName or getSourceMethodName if they expect to use them after passing the LogRecord object to another thread or transmitting it over RMI.

Summary

Public Constructors
LogRecord(Level level, String msg)
Constructs a LogRecord object using the supplied the logging level and message.
Public Methods
Level getLevel()
Gets the logging level.
String getLoggerName()
Gets the name of the logger.
String getMessage()
Gets the raw message.
long getMillis()
Gets the time that the event occurred, in milliseconds since 1970.
Object[] getParameters()
Gets the parameters.
ResourceBundle getResourceBundle()
Gets the resource bundle used to localize the raw message during formatting.
String getResourceBundleName()
Gets the name of the resource bundle.
long getSequenceNumber()
Gets the sequence number.
String getSourceClassName()
Gets the name of the class that issued the logging call.
String getSourceMethodName()
Gets the name of the method that issued the logging call.
int getThreadID()
Gets the ID of the thread originating the message.
Throwable getThrown()
Gets the Throwable object associated with this log record.
void setLevel(Level level)
Sets the logging level.
void setLoggerName(String loggerName)
Sets the name of the logger.
void setMessage(String message)
Sets the raw message.
void setMillis(long millis)
Sets the time that the event occurred, in milliseconds since 1970.
void setParameters(Object[] parameters)
Sets the parameters.
void setResourceBundle(ResourceBundle resourceBundle)
Sets the resource bundle used to localize the raw message during formatting.
void setResourceBundleName(String resourceBundleName)
Sets the name of the resource bundle.
void setSequenceNumber(long sequenceNumber)
Sets the sequence number.
void setSourceClassName(String sourceClassName)
Sets the name of the class that issued the logging call.
void setSourceMethodName(String sourceMethodName)
Sets the name of the method that issued the logging call.
void setThreadID(int threadID)
Sets the ID of the thread originating the message.
void setThrown(Throwable thrown)
Sets the Throwable object associated with this log record.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public LogRecord (Level level, String msg)

Constructs a LogRecord object using the supplied the logging level and message. The millis property is set to the current time. The sequence property is set to a new unique value, allocated in increasing order within a VM. The thread ID is set to a unique value for the current thread. All other properties are set to null.

Parameters
level the logging level which may not be null
msg the raw message

Public Methods

public Level getLevel ()

Gets the logging level.

Returns
  • the logging level

public String getLoggerName ()

Gets the name of the logger.

Returns
  • the logger name

public String getMessage ()

Gets the raw message.

Returns
  • the raw message

public long getMillis ()

Gets the time that the event occurred, in milliseconds since 1970.

Returns
  • the time that the event occurred, in milliseconds since 1970

public Object[] getParameters ()

Gets the parameters.

Returns
  • the array of parameters

public ResourceBundle getResourceBundle ()

Gets the resource bundle used to localize the raw message during formatting.

Returns
  • the associated resource bundle

public String getResourceBundleName ()

Gets the name of the resource bundle.

Returns
  • the name of the resource bundle

public long getSequenceNumber ()

Gets the sequence number.

Returns
  • the sequence number

public String getSourceClassName ()

Gets the name of the class that issued the logging call.

Returns
  • the name of the class that issued the logging call

public String getSourceMethodName ()

Gets the name of the method that issued the logging call.

Returns
  • the name of the method that issued the logging call

public int getThreadID ()

Gets the ID of the thread originating the message.

Returns
  • the ID of the thread originating the message

public Throwable getThrown ()

Gets the Throwable object associated with this log record.

Returns
  • the Throwable object associated with this log record

public void setLevel (Level level)

Sets the logging level.

Parameters
level the level to set

public void setLoggerName (String loggerName)

Sets the name of the logger.

Parameters
loggerName the logger name to set

public void setMessage (String message)

Sets the raw message.

Parameters
message the raw message to set

public void setMillis (long millis)

Sets the time that the event occurred, in milliseconds since 1970.

Parameters
millis the time that the event occurred, in milliseconds since 1970

public void setParameters (Object[] parameters)

Sets the parameters.

Parameters
parameters the array of parameters to set

public void setResourceBundle (ResourceBundle resourceBundle)

Sets the resource bundle used to localize the raw message during formatting.

Parameters
resourceBundle the resource bundle to set

public void setResourceBundleName (String resourceBundleName)

Sets the name of the resource bundle.

Parameters
resourceBundleName the name of the resource bundle to set

public void setSequenceNumber (long sequenceNumber)

Sets the sequence number. It is usually unnecessary to call this method to change the sequence number because the number is allocated when this instance is constructed.

Parameters
sequenceNumber the sequence number to set

public void setSourceClassName (String sourceClassName)

Sets the name of the class that issued the logging call.

Parameters
sourceClassName the name of the class that issued the logging call

public void setSourceMethodName (String sourceMethodName)

Sets the name of the method that issued the logging call.

Parameters
sourceMethodName the name of the method that issued the logging call

public void setThreadID (int threadID)

Sets the ID of the thread originating the message.

Parameters
threadID the ID of the thread originating the message

public void setThrown (Throwable thrown)

Sets the Throwable object associated with this log record.

Parameters
thrown the Throwable object associated with this log record