Interface LogRecordEmitter
-
- All Superinterfaces:
ListenerInfo,NotificationBroadcaster,NotificationEmitter
@Taxonomy(stability=EXPERIMENTAL) public interface LogRecordEmitter extends NotificationEmitter, ListenerInfo
EmitsLogRecordas JMXNotification.The
LogRecordis embedded within a Notification as follows: notif.getType() => a Notification type beginning withLOG_RECORD_NOTIFICATION_PREFIX
notif.getSource() => ObjectName ofLoggingMBean that emitted the Notification notif.getUserData() => Map<String,Object> with keys as described below.To avoid deserialization problems, an actual
LogRecordis not transmitted. Instead, its important fields are extracted and placed into a Map obtained as follows:
Alternately, you may usefinal Mapfields = (Map )notif.getUserData(); Util.getAMXNotificationValue(javax.management.Notification, java.lang.String)to extract any] particular field.Valid keys within the Map are:
LOG_RECORD_AS_STRING_KEYvalue is the String version of the entire LogRecord
Here is an example of how to retrieve the LogRecord information when a Notification is received:
final Notifcation notif =
; final String type = notif.getType(); final LogRecord logRecord = (LogRecord) Util.getAMXNotificationValue(javax.management.Notification, java.lang.String)( notif, LOG_RECORD_KEY ); final String logRecordString = (String)Util.getAMXNotificationValue(javax.management.Notification, java.lang.String)( notif, LOG_RECORD_STRING_KEY );- Since:
- AS 9.0
-
-
Field Summary
Fields Modifier and Type Field Description static Set<String>ALL_LOG_RECORD_NOTIFICATION_TYPESstatic StringLOG_RECORD_AS_STRING_KEYKey to access the string representation of theLogRecord.static StringLOG_RECORD_CONFIG_NOTIFICATION_TYPENotification type for a CONFIG LogRecordstatic StringLOG_RECORD_FINE_NOTIFICATION_TYPENotification type for a FINE LogRecordstatic StringLOG_RECORD_FINER_NOTIFICATION_TYPENotification type for a FINER LogRecordstatic StringLOG_RECORD_FINEST_NOTIFICATION_TYPENotification type for a FINEST LogRecordstatic StringLOG_RECORD_INFO_NOTIFICATION_TYPENotification type for an INFO LogRecordstatic StringLOG_RECORD_KEY_PREFIXAll keys within the Map found in Notification.getUserData() have this prefix.static StringLOG_RECORD_LEVEL_KEYvalue: Levelstatic StringLOG_RECORD_LOGGER_NAME_KEYvalue: Stringstatic StringLOG_RECORD_MESSAGE_KEYvalue: Stringstatic StringLOG_RECORD_MILLIS_KEYvalue: Longstatic StringLOG_RECORD_NOTIFICATION_PREFIXNotification type prefix for a LogRecord Notificationstatic StringLOG_RECORD_OTHER_NOTIFICATION_TYPENotification type for any other level eg a specific level number not equivalent to any of the standard onesstatic StringLOG_RECORD_ROOT_CAUSE_KEYvalue: Throwablestatic StringLOG_RECORD_SEQUENCE_NUMBER_KEYvalue: Longstatic StringLOG_RECORD_SEVERE_NOTIFICATION_TYPENotification type for a SEVERE LogRecordstatic StringLOG_RECORD_SOURCE_CLASS_NAME_KEYvalue: Stringstatic StringLOG_RECORD_SOURCE_METHOD_NAME_KEYvalue: Stringstatic StringLOG_RECORD_THREAD_ID_KEYvalue: Integerstatic StringLOG_RECORD_THROWN_KEYvalue: Throwablestatic StringLOG_RECORD_WARNING_NOTIFICATION_TYPENotification type for a WARNING LogRecord
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intgetLogLevelListenerCount(Level logLevel)Get the number of listeners for the specified log level.-
Methods inherited from interface org.glassfish.admin.amx.base.ListenerInfo
getListenerCount, getNotificationTypeListenerCount
-
Methods inherited from interface javax.management.NotificationBroadcaster
addNotificationListener, getNotificationInfo, removeNotificationListener
-
Methods inherited from interface javax.management.NotificationEmitter
removeNotificationListener
-
-
-
-
Field Detail
-
LOG_RECORD_NOTIFICATION_PREFIX
static final String LOG_RECORD_NOTIFICATION_PREFIX
Notification type prefix for a LogRecord Notification- See Also:
- Constant Field Values
-
LOG_RECORD_SEVERE_NOTIFICATION_TYPE
static final String LOG_RECORD_SEVERE_NOTIFICATION_TYPE
Notification type for a SEVERE LogRecord
-
LOG_RECORD_WARNING_NOTIFICATION_TYPE
static final String LOG_RECORD_WARNING_NOTIFICATION_TYPE
Notification type for a WARNING LogRecord
-
LOG_RECORD_INFO_NOTIFICATION_TYPE
static final String LOG_RECORD_INFO_NOTIFICATION_TYPE
Notification type for an INFO LogRecord
-
LOG_RECORD_CONFIG_NOTIFICATION_TYPE
static final String LOG_RECORD_CONFIG_NOTIFICATION_TYPE
Notification type for a CONFIG LogRecord
-
LOG_RECORD_FINE_NOTIFICATION_TYPE
static final String LOG_RECORD_FINE_NOTIFICATION_TYPE
Notification type for a FINE LogRecord
-
LOG_RECORD_FINER_NOTIFICATION_TYPE
static final String LOG_RECORD_FINER_NOTIFICATION_TYPE
Notification type for a FINER LogRecord
-
LOG_RECORD_FINEST_NOTIFICATION_TYPE
static final String LOG_RECORD_FINEST_NOTIFICATION_TYPE
Notification type for a FINEST LogRecord
-
LOG_RECORD_OTHER_NOTIFICATION_TYPE
static final String LOG_RECORD_OTHER_NOTIFICATION_TYPE
Notification type for any other level eg a specific level number not equivalent to any of the standard ones- See Also:
- Constant Field Values
-
LOG_RECORD_KEY_PREFIX
static final String LOG_RECORD_KEY_PREFIX
All keys within the Map found in Notification.getUserData() have this prefix.- See Also:
- Constant Field Values
-
LOG_RECORD_AS_STRING_KEY
static final String LOG_RECORD_AS_STRING_KEY
Key to access the string representation of theLogRecord. This value will always be present and non-null. Use LOG_RECORD_STRING_KEY to obtain this value.- See Also:
- Constant Field Values
-
LOG_RECORD_LEVEL_KEY
static final String LOG_RECORD_LEVEL_KEY
value: Level- See Also:
- Constant Field Values
-
LOG_RECORD_LOGGER_NAME_KEY
static final String LOG_RECORD_LOGGER_NAME_KEY
value: String- See Also:
- Constant Field Values
-
LOG_RECORD_MESSAGE_KEY
static final String LOG_RECORD_MESSAGE_KEY
value: String- See Also:
- Constant Field Values
-
LOG_RECORD_MILLIS_KEY
static final String LOG_RECORD_MILLIS_KEY
value: Long- See Also:
- Constant Field Values
-
LOG_RECORD_SEQUENCE_NUMBER_KEY
static final String LOG_RECORD_SEQUENCE_NUMBER_KEY
value: Long- See Also:
- Constant Field Values
-
LOG_RECORD_SOURCE_CLASS_NAME_KEY
static final String LOG_RECORD_SOURCE_CLASS_NAME_KEY
value: String- See Also:
- Constant Field Values
-
LOG_RECORD_SOURCE_METHOD_NAME_KEY
static final String LOG_RECORD_SOURCE_METHOD_NAME_KEY
value: String- See Also:
- Constant Field Values
-
LOG_RECORD_THREAD_ID_KEY
static final String LOG_RECORD_THREAD_ID_KEY
value: Integer- See Also:
- Constant Field Values
-
LOG_RECORD_THROWN_KEY
static final String LOG_RECORD_THROWN_KEY
value: ThrowableAll Throwables are remapped to standard java exceptions; the value will be a Throwable, but it may not be the original Throwable as thrown on the server side.
If nothing was thrown this key will not be found in the Map.
- See Also:
- Constant Field Values
-
LOG_RECORD_ROOT_CAUSE_KEY
static final String LOG_RECORD_ROOT_CAUSE_KEY
value: ThrowableIf LogRecord.getThrown() was non-null, this value is the innermost Throwable eg the root cause found by following Throwable.getCause() until the innermost Throwable is reached.
If the root cause is the same as the thrown exception, then this value will not exist.
- See Also:
- Constant Field Values
-
-
Method Detail
-
getLogLevelListenerCount
@ManagedOperation(impact=0) int getLogLevelListenerCount(@Param(name="logLevel") Level logLevel)
Get the number of listeners for the specified log level.- Parameters:
logLevel-- Returns:
- number of listeners listening for messages of the specified level, or higher level
-
-