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.
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.
(->log-record level msg)
Constructor.
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".
level - a logging level value - java.util.logging.Level
msg - the raw non-localized logging message (may be null) - java.lang.String
Constructor. 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". level - a logging level value - `java.util.logging.Level` msg - the raw non-localized logging message (may be null) - `java.lang.String`
(get-level this)
Get the logging message level, for example Level.SEVERE.
returns: the logging message level - java.util.logging.Level
Get the logging message level, for example Level.SEVERE. returns: the logging message level - `java.util.logging.Level`
(get-logger-name this)
Get the source Logger's name.
returns: source logger name (may be null) - java.lang.String
Get the source Logger's name. returns: source logger name (may be null) - `java.lang.String`
(get-message this)
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 - java.lang.String
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 - `java.lang.String`
(get-millis this)
Get event time in milliseconds since 1970.
returns: event time in millis since 1970 - long
Get event time in milliseconds since 1970. returns: event time in millis since 1970 - `long`
(get-parameters this)
Get the parameters to the log message.
returns: the log message parameters. May be null if
there are no parameters. - java.lang.Object[]
Get the parameters to the log message. returns: the log message parameters. May be null if there are no parameters. - `java.lang.Object[]`
(get-resource-bundle this)
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 - java.util.ResourceBundle
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 - `java.util.ResourceBundle`
(get-resource-bundle-name this)
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 - java.lang.String
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 - `java.lang.String`
(get-sequence-number this)
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 - long
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 - `long`
(get-source-class-name this)
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 - java.lang.String
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 - `java.lang.String`
(get-source-method-name this)
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 - java.lang.String
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 - `java.lang.String`
(get-thread-id this)
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 - int
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 - `int`
(get-thrown this)
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 - java.lang.Throwable
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 - `java.lang.Throwable`
(set-level this level)
Set the logging message level, for example Level.SEVERE.
level - the logging message level - java.util.logging.Level
Set the logging message level, for example Level.SEVERE. level - the logging message level - `java.util.logging.Level`
(set-logger-name this name)
Set the source Logger's name.
name - the source logger name (may be null) - java.lang.String
Set the source Logger's name. name - the source logger name (may be null) - `java.lang.String`
(set-message this message)
Set the "raw" log message, before localization or formatting.
message - the raw message string (may be null) - java.lang.String
Set the "raw" log message, before localization or formatting. message - the raw message string (may be null) - `java.lang.String`
(set-millis this millis)
Set event time.
millis - event time in millis since 1970 - long
Set event time. millis - event time in millis since 1970 - `long`
(set-parameters this parameters)
Set the parameters to the log message.
parameters - the log message parameters. (may be null) - java.lang.Object[]
Set the parameters to the log message. parameters - the log message parameters. (may be null) - `java.lang.Object[]`
(set-resource-bundle this bundle)
Set the localization resource bundle.
bundle - localization bundle (may be null) - java.util.ResourceBundle
Set the localization resource bundle. bundle - localization bundle (may be null) - `java.util.ResourceBundle`
(set-resource-bundle-name this name)
Set the localization resource bundle name.
name - localization bundle name (may be null) - java.lang.String
Set the localization resource bundle name. name - localization bundle name (may be null) - `java.lang.String`
(set-sequence-number this 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.
seq - the sequence number - long
Set the sequence number. Sequence numbers are normally assigned in the LogRecord constructor, so it should not normally be necessary to use this method. seq - the sequence number - `long`
(set-source-class-name this source-class-name)
Set the name of the class that (allegedly) issued the logging request.
source-class-name - the source class name (may be null) - java.lang.String
Set the name of the class that (allegedly) issued the logging request. source-class-name - the source class name (may be null) - `java.lang.String`
(set-source-method-name this source-method-name)
Set the name of the method that (allegedly) issued the logging request.
source-method-name - the source method name (may be null) - java.lang.String
Set the name of the method that (allegedly) issued the logging request. source-method-name - the source method name (may be null) - `java.lang.String`
(set-thread-id this thread-id)
Set an identifier for the thread where the message originated.
thread-id - the thread ID - int
Set an identifier for the thread where the message originated. thread-id - the thread ID - `int`
(set-thrown this thrown)
Set a throwable associated with the log event.
thrown - a throwable (may be null) - java.lang.Throwable
Set a throwable associated with the log event. thrown - a throwable (may be null) - `java.lang.Throwable`
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close