The LogRecord class wraps the messages logged to a Logger . You can either logs a LogRecord directly to a Logger , or has the Logger wrap what's logged in a LogRecord . That's, all logging methods on the that does not take Logger a would LogRecord wrap the parameters passed to the log method in a c8/> object.
Once A is LogRecord passed to, or produced internally by Logger the, it can be passed to a Filter (if a filter was set) to ' s, and to Logger ' s further op the Logger hierarchy.
LogRecordthe contains the following getter methods, which can be used on e.g. A to Filter determine if the LogRecord should is Logg Ed or not:
Getlevel () Getloggername () GetMessage () Getmillis () getparameters () Getresourcebundle () Getresourcebundlename () Getsequencenumber () Getsourceclassname () Getsourcemethodname () GetThreadId () Getthrown ()
Each of the these getter methods has a corresponding setter method too, but unless you create LogRecord instances yourself, you wo N ' t need the setter methods. Here is a brief explanation of the getter methods.
The method returns the log level of the message represented by this is getLevel() LogRecord logged with.
The getLoggerName() method returns the name of the Logger logged this LogRecord .
The getMessage() method returns the message logged.
The getMillis() method returns the time in milliseconds is LogRecord recorded.
The getParameters() method returns the parameters to being inserted into the message of this LogRecord .
The getResourceBundle() method returns the ResourceBundle (if any) used to localize the message of this LogRecord . If no ResourceBundle is used, the This method returns NULL.
The getResourceBundleName() method returns the name of the ResourceBundle (if any) used to localize the message of this LogRecord . If no ResourceBundle is used, and null is returned.
The getSequenceNumber() method returns a sequence number generated internally in the constructor when the is LogRecord LogRecord created.
The getSourceClassName() returns the class name of the class logging the message represented by this LogRecord . Keep in mind though, which this name is not being entirely correct for various reasons. See the JavaDoc for more details.
The getSourceMethodName() returns the method name of the method logging the message represented by this LogRecord . Keep in mind though, which this name is not being entirely correct for various reasons. See the JavaDoc for more details.
The getThreadID() method returns the ID of the thread logging the message represented by this LogRecord .
The getThrown() method returns the that is Throwable marked thrown when logging the message represented by this LogRecord . This Throwable was either passed as parameter to a Logger log method, or set directly on a LogRecord which are then passed to a . This was Throwable typically what caused the log message to be logged.
Java Logging:logrecord