Interface LogAnalyzer
-
@Taxonomy(stability=EXPERIMENTAL) public interface LogAnalyzer
Provides summary information about important logging events. PRELIMINARY--SUBJECT TO CHANGES/ADDITIONS- Since:
- AS 9.0
-
-
Field Summary
Fields Modifier and Type Field Description static String
MODULE_NAME_KEY
Key into any Map returned fromgetErrorDistribution(long, java.lang.String)
.static String
SEVERE_COUNT_KEY
Key into any Map returned fromgetErrorInfo()
.static String
TIMESTAMP_KEY
Key into any Map returned fromgetErrorInfo()
.static String
WARNING_COUNT_KEY
Key into any Map returned fromgetErrorInfo()
.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Map<String,Integer>
getErrorDistribution(long timestamp, String level)
Get the number of log entries for a particular timestamp of a particularLevel
for all modules.Map<String,Number>[]
getErrorInfo()
Get a summary of theLevel.SEVERE
andLevel.WARNING
log entries for the known history.long
getErrorStatisticsIntervalMinutes()
int
getKeepErrorStatisticsForIntervals()
String[]
getLoggerNames()
String[]
getLoggerNamesUnder(String loggerName)
void
setErrorStatisticsIntervalMinutes(long minutes)
Set the duration of an interval.void
setKeepErrorStatisticsForIntervals(int numIntervals)
Set the number of intervals error statistics should be maintained.
-
-
-
Field Detail
-
TIMESTAMP_KEY
static final String TIMESTAMP_KEY
Key into any Map returned fromgetErrorInfo()
. value is of type Long.- See Also:
- Constant Field Values
-
SEVERE_COUNT_KEY
static final String SEVERE_COUNT_KEY
Key into any Map returned fromgetErrorInfo()
. value is of type Long.- See Also:
- Constant Field Values
-
WARNING_COUNT_KEY
static final String WARNING_COUNT_KEY
Key into any Map returned fromgetErrorInfo()
. value is of type Long.- See Also:
- Constant Field Values
-
MODULE_NAME_KEY
static final String MODULE_NAME_KEY
Key into any Map returned fromgetErrorDistribution(long, java.lang.String)
. value is of type String.- See Also:
- Constant Field Values
-
-
Method Detail
-
getErrorInfo
@ManagedAttribute Map<String,Number>[] getErrorInfo()
Get a summary of theLevel.SEVERE
andLevel.WARNING
log entries for the known history. Each entry in the resulting array is a Map with the following keys:TIMESTAMP_KEY
of type LongSEVERE_COUNT_KEY
of type IntegerWARNING_COUNT_KEY
of type Integer
The timestamp obtained from each Map may be used as the timestamp when calling
getErrorDistribution(long, java.lang.String)
. For example:
final Map
[] infos = logging.getErrorInfo();
for( int i = 0; i < infos.length; ++i ) {
final Mapinfo = infos[ i ];
final long timestamp = ((Long)info.get( TIMESTAMP_KEY )).longValue();
Mapcounts = getErrorDistribution( timestamp );
}- Returns:
- Map
-
getErrorDistribution
@ManagedOperation Map<String,Integer> getErrorDistribution(@Param(name="timestamp") long timestamp, @Param(name="level") String level)
Get the number of log entries for a particular timestamp of a particularLevel
for all modules. SEVERE and WARNING are the only levels supported.The resulting Map is keyed by the module ID, which may be any of the values found in
LogModuleNames
or any valid Logger name. The corresponding value is the count for that module of the requested level.- Parameters:
timestamp
- a timestamp as obtained using TIME_STAMP_KEY from one of the Maps returned bygetErrorInfo()
. Note that it is a 'long' not a 'Long' and is required.level
-- Returns:
- Map
-
getLoggerNames
@ManagedAttribute String[] getLoggerNames()
- Returns:
- all the logger names currently in use
-
getLoggerNamesUnder
@ManagedOperation(impact=0) String[] getLoggerNamesUnder(@Param(name="loggerName") String loggerName)
- Returns:
- all the logger names currently in use under this logger.
-
setKeepErrorStatisticsForIntervals
@ManagedAttribute void setKeepErrorStatisticsForIntervals(@Param(name="numIntervals") int numIntervals)
Set the number of intervals error statistics should be maintained.- Parameters:
numIntervals
- number of intervals
-
getKeepErrorStatisticsForIntervals
@ManagedAttribute int getKeepErrorStatisticsForIntervals()
-
setErrorStatisticsIntervalMinutes
@ManagedAttribute void setErrorStatisticsIntervalMinutes(@Param(name="minutes") long minutes)
Set the duration of an interval.- Parameters:
minutes
- The duration of an interval in minutes.
-
getErrorStatisticsIntervalMinutes
@ManagedAttribute long getErrorStatisticsIntervalMinutes()
-
-