Package fr.dyade.aaa.common.monitoring
Class LogMonitoringTimerTask
- java.lang.Object
-
- java.util.TimerTask
-
- fr.dyade.aaa.common.monitoring.MonitoringTimerTask
-
- fr.dyade.aaa.common.monitoring.LogMonitoringTimerTask
-
- All Implemented Interfaces:
MonitoringTimerTaskMBean,Runnable
public class LogMonitoringTimerTask extends MonitoringTimerTask
TheLogMonitoringTimerTaskclass allows to periodically watch JMX attributes and write the corresponding values in the logging mechanism.
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_MONITORING_CONFIG_PATHDefault value for the pathname of a configuration file for a log monitoring task in the server, value islogMonitoring.props.static longDEFAULT_MONITORING_CONFIG_PERIODDefault value for the scanning period for the log monitoring task in the server, value is60000L(60 seconds).static intDEFAULT_MONITORING_RESULT_LEVELDefault value for the logging level of the results for the log monitoring task in the server, value isWARN.static StringDEFAULT_MONITORING_RESULT_LOGGERDefault value for the logger name of the results for the log monitoring task in the server, value isfr.dyade.aaa.agent.Monitoring.static StringDEFAULT_MONITORING_RESULT_MESSAGEDefault value for the logging message of the results for the log monitoring task in the server, value is"JMX Monitoring ".(package private) intlevelLevel of monitoring messages.static StringMONITORING_CONFIG_PATH_PROPERTYName of property allowing to fix the pathname of a configuration file for a log monitoring task in the server.static StringMONITORING_CONFIG_PERIOD_PROPERTYName of property allowing to fix the scanning period for the log monitoring task in the server.static StringMONITORING_RESULT_LEVEL_PROPERTYName of property allowing to fix the logging level of the results for the log monitoring task in the server.static StringMONITORING_RESULT_LOGGER_PROPERTYName of property allowing to fix the logger name of the results for the log monitoring task in the server.static StringMONITORING_RESULT_MESSAGE_PROPERTYName of property allowing to set the logging message of the results for the log monitoring task in the server.(package private) LoggermonitoringLoggerLogger to write results.(package private) StringmsgMessage to log.(package private) StringBufferstrbuf-
Fields inherited from class fr.dyade.aaa.common.monitoring.MonitoringTimerTask
attlist, logger, mbeanName, timerPeriod
-
-
Constructor Summary
Constructors Constructor Description LogMonitoringTimerTask()Instantiates theLogMonitoringTimerTaskcomponent.LogMonitoringTimerTask(Timer timer, long period, Properties attlist, Logger logger, String msg, int level)Initializes theLogMonitoringTimerTaskcomponent.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddRecord(String mbean, String att, Object value)Records information about the specified attribute.protected voidfinalizeRecords()Finalize the record for the current time.protected intgetLevel(String levelName)Return the int value of the String BasicLevelvoidinit(Timer timer, long period, Properties attlist, Properties taskProps)Initializes theLogMonitoringTimerTaskcomponent.protected voidinitializeRecords()Initialize the record for the current collect time.-
Methods inherited from class fr.dyade.aaa.common.monitoring.MonitoringTimerTask
addMonitoredAttributes, cancelTask, delMonitoredAttributes, getMonitoredAttributes, getPeriod, run, start
-
Methods inherited from class java.util.TimerTask
cancel, scheduledExecutionTime
-
-
-
-
Field Detail
-
MONITORING_CONFIG_PERIOD_PROPERTY
public static final String MONITORING_CONFIG_PERIOD_PROPERTY
Name of property allowing to fix the scanning period for the log monitoring task in the server.This property can be fixed either from
javalaunching command, or ina3servers.xmlconfiguration file.- See Also:
LogMonitoringTimerTask, Constant Field Values
-
DEFAULT_MONITORING_CONFIG_PERIOD
public static final long DEFAULT_MONITORING_CONFIG_PERIOD
Default value for the scanning period for the log monitoring task in the server, value is60000L(60 seconds).- See Also:
MonitoringTimerTask, Constant Field Values
-
MONITORING_CONFIG_PATH_PROPERTY
public static final String MONITORING_CONFIG_PATH_PROPERTY
Name of property allowing to fix the pathname of a configuration file for a log monitoring task in the server.This property can be fixed either from
javalaunching command, or ina3servers.xmlconfiguration file.- See Also:
LogMonitoringTimerTask, Constant Field Values
-
DEFAULT_MONITORING_CONFIG_PATH
public static final String DEFAULT_MONITORING_CONFIG_PATH
Default value for the pathname of a configuration file for a log monitoring task in the server, value islogMonitoring.props.If the file does not exist the timer task is not launched.
- See Also:
LogMonitoringTimerTask, Constant Field Values
-
MONITORING_RESULT_LOGGER_PROPERTY
public static final String MONITORING_RESULT_LOGGER_PROPERTY
Name of property allowing to fix the logger name of the results for the log monitoring task in the server.This property can be fixed either from
javalaunching command, or ina3servers.xmlconfiguration file.- See Also:
LogMonitoringTimerTask, Constant Field Values
-
DEFAULT_MONITORING_RESULT_LOGGER
public static final String DEFAULT_MONITORING_RESULT_LOGGER
Default value for the logger name of the results for the log monitoring task in the server, value isfr.dyade.aaa.agent.Monitoring.- See Also:
LogMonitoringTimerTask, Constant Field Values
-
MONITORING_RESULT_LEVEL_PROPERTY
public static final String MONITORING_RESULT_LEVEL_PROPERTY
Name of property allowing to fix the logging level of the results for the log monitoring task in the server.This property can be fixed either from
javalaunching command, or ina3servers.xmlconfiguration file.- See Also:
LogMonitoringTimerTask, Constant Field Values
-
DEFAULT_MONITORING_RESULT_LEVEL
public static final int DEFAULT_MONITORING_RESULT_LEVEL
Default value for the logging level of the results for the log monitoring task in the server, value isWARN.- See Also:
LogMonitoringTimerTask
-
MONITORING_RESULT_MESSAGE_PROPERTY
public static final String MONITORING_RESULT_MESSAGE_PROPERTY
Name of property allowing to set the logging message of the results for the log monitoring task in the server.This property can be fixed either from
javalaunching command, or ina3servers.xmlconfiguration file.- See Also:
LogMonitoringTimerTask, Constant Field Values
-
DEFAULT_MONITORING_RESULT_MESSAGE
public static final String DEFAULT_MONITORING_RESULT_MESSAGE
Default value for the logging message of the results for the log monitoring task in the server, value is"JMX Monitoring ".- See Also:
LogMonitoringTimerTask, Constant Field Values
-
monitoringLogger
Logger monitoringLogger
Logger to write results.
-
msg
String msg
Message to log.
-
level
int level
Level of monitoring messages.
-
strbuf
StringBuffer strbuf
-
-
Constructor Detail
-
LogMonitoringTimerTask
public LogMonitoringTimerTask(Timer timer, long period, Properties attlist, Logger logger, String msg, int level)
Initializes theLogMonitoringTimerTaskcomponent.- Parameters:
timer- Timer to use to schedule the resulting task.period- Period value of the resulting taskattlist- List of JMX attributes to periodically watch.logger- Logger to write results.msg- Message to log.level- Level of monitoring messages.
-
LogMonitoringTimerTask
public LogMonitoringTimerTask()
Instantiates theLogMonitoringTimerTaskcomponent.
-
-
Method Detail
-
init
public void init(Timer timer, long period, Properties attlist, Properties taskProps)
Initializes theLogMonitoringTimerTaskcomponent.- Specified by:
initin classMonitoringTimerTask- Parameters:
timer- The timer to use to schedule the resulting task.period- Period value of the resulting taskattlist- List of JMX attributes to periodically watch.taskProps- The properties to initialize the task.
-
initializeRecords
protected void initializeRecords()
Initialize the record for the current collect time. For the FileMonitoringTimer, it consists to initialize a StringBuffer to collect informations about all attributes.- Specified by:
initializeRecordsin classMonitoringTimerTask- See Also:
MonitoringTimerTask.initializeRecords()
-
addRecord
protected void addRecord(String mbean, String att, Object value)
Records information about the specified attribute.- Specified by:
addRecordin classMonitoringTimerTask- Parameters:
mbean- The name of the related mbean.att- The name of the related attribute.value- The value of the related attribute.
-
finalizeRecords
protected void finalizeRecords()
Finalize the record for the current time.- Specified by:
finalizeRecordsin classMonitoringTimerTask- See Also:
MonitoringTimerTask.finalizeRecords()
-
getLevel
protected int getLevel(String levelName)
Return the int value of the String BasicLevel- Parameters:
levelName- The name of the BasicLevel- Returns:
- the int value of the String BasicLevel.
-
-