Team LiB
Previous Section Next Section

LogRecordjava.util.logging

Java 1.4serializable

Instances of this class are used to represent log messages as they are passed between Logger, Handler, Filter and Formatter objects. LogRecord defines a number of JavaBeans-type property getter and setter methods. The values of the various properties encapsulate all details of the log message. The LogRecord( ) constructor takes arguments for the two most important properties: the log level and the log message (or localization key). The constructor also initializes the millis property to the current time, the sequenceNumber property to a unique (within the VM) value that can be used to compare the order of two log messages, and the threadID property to a unique identifier for the current thread. All other properties of the LogRecord are left uninitialized with their default null values.

Figure 16-118. java.util.logging.LogRecord


public class LogRecord implements Serializable {
// Public Constructors
     public LogRecord(Level level, String msg);  
// Public Instance Methods
     public Level getLevel( );  
     public String getLoggerName( );  
     public String getMessage( );  
     public long getMillis( );  
     public Object[ ] getParameters( );  
     public java.util.ResourceBundle getResourceBundle( );  
     public String getResourceBundleName( );  
     public long getSequenceNumber( );  
     public String getSourceClassName( );  
     public String getSourceMethodName( );  
     public int getThreadID( );  
     public Throwable getThrown( );  
     public void setLevel(Level level);  
     public void setLoggerName(String name);  
     public void setMessage(String message);  
     public void setMillis(long millis);  
     public void setParameters(Object[ ] parameters);  
     public void setResourceBundle(java.util.ResourceBundle bundle);  
     public void setResourceBundleName(String name);  
     public void setSequenceNumber(long seq);  
     public void setSourceClassName(String sourceClassName);  
     public void setSourceMethodName(String sourceMethodName);  
     public void setThreadID(int threadID);  
     public void setThrown(Throwable thrown);  
}

Passed To

ConsoleHandler.publish( ), FileHandler.publish( ), Filter.isLoggable( ), java.util.logging.Formatter.{format( ), formatMessage( )}, Handler.{isLoggable( ), publish( )}, Logger.log( ), MemoryHandler.{isLoggable( ), publish( )}, SimpleFormatter.format( ), SocketHandler.publish( ), StreamHandler.{isLoggable( ), publish( )}, XMLFormatter.format( )

    Team LiB
    Previous Section Next Section