FileMonitoringTimerTask.DEFAULT_MONITORING_CONFIG_PERIOD).longValue();
String results = getProperty(FileMonitoringTimerTask.MONITORING_RESULT_PATH_PROPERTY,
FileMonitoringTimerTask.DEFAULT_MONITORING_RESULT_PATH);
Properties monitoringProps = new Properties();
monitoringProps.load(new FileInputStream(file));
fileMonitoringTimerTask = new FileMonitoringTimerTask(getTimer(), period, monitoringProps, results);
if (fileMonitoringTimerTask != null) {
try {
MXWrapper.registerMBean(fileMonitoringTimerTask,
"AgentServer", "server=" + getName() + ",cons=FileMonitoring");
} catch (Exception exc) {
if (logmon == null)
logmon = Debug.getLogger(AgentServer.class.getName());
logmon.log(BasicLevel.ERROR, getName() + " jmx failed", exc);
}
}
}
} catch (Exception exc) {
logmon.log(BasicLevel.WARN, getName() + "Cannot read monitoring configuration file: " + config, exc);
}
config = getProperty(LogMonitoringTimerTask.MONITORING_CONFIG_PATH_PROPERTY,
LogMonitoringTimerTask.DEFAULT_MONITORING_CONFIG_PATH);
try {
// if "logMonitoring.props" file exists configure a FileMonitoringTimerTask.
File file = new File(config);
if (file.exists()) {
long period = getLong(LogMonitoringTimerTask.MONITORING_CONFIG_PERIOD_PROPERTY,
LogMonitoringTimerTask.DEFAULT_MONITORING_CONFIG_PERIOD).longValue();
String logname = getProperty(LogMonitoringTimerTask.MONITORING_RESULT_LOGGER_PROPERTY,
LogMonitoringTimerTask.DEFAULT_MONITORING_RESULT_LOGGER);
Logger logger = Debug.getLogger(logname);
int loglevel = getInteger(LogMonitoringTimerTask.MONITORING_RESULT_LEVEL_PROPERTY,
LogMonitoringTimerTask.DEFAULT_MONITORING_RESULT_LEVEL).intValue();
String logmsg = getProperty(LogMonitoringTimerTask.MONITORING_RESULT_MESSAGE_PROPERTY,
LogMonitoringTimerTask.DEFAULT_MONITORING_RESULT_MESSAGE);
Properties monitoringProps = new Properties();
monitoringProps.load(new FileInputStream(file));
logMonitoringTimerTask = new LogMonitoringTimerTask(getTimer(), period, monitoringProps,
logger, logmsg, loglevel);
if (logMonitoringTimerTask != null) {