The logging is not reliable.
After debugging i found out that the loggingMode variable of the SensorRunner is wrongly defined.
/**
* Result logging mode.
*
* @var bool
*/
protected $loggingMode = FALSE;
/**
* Sets result logging mode.
*
* @param string $mode
* (NULL, on_request, all)
*/
public function setLoggingMode($mode) {
$this->loggingMode = $mode;
}
And this is the correct instanciation in monitoring.module.
$runner = new SensorRunner($sensors_info);
$runner->setLoggingMode(variable_get('monitoring_sensor_call_logging', 'on_request'));
$runner->verbose($get_verbose_output);
While monitoring.admin.inc lacks setLoggingMode().
Comments
Comment #1
miro_dietikerProviding patch that makes logging behaviour reliable and as expected again.
Also with some rename of saveResults to logResults.
I also thought about initializing the loggingMode member variable within __constructor to the default (configured) value. However, sounds like similarly unclean OOP wise (?).
I'm confused the idea of moving logging into the SensorRunner was to have consistent logging results.
The different run contexts with logging settings need testing though.
Comment #2
miro_dietikerComment #4
berdirYes, as discussed, this should be set to the default automatically. Constructor is fine for now, in 8.x, we might want to think about a runner factory service or so.
Comment #5
miro_dietikerAs discussed, moving the runner configuration into constructor.
Default NULL replaced with 'none'.
Comment #6
miro_dietikerFixed.
Comment #7
miro_dietikerComment #8
ytsurkthis is partiallly tested - look for this in monitoring.api.test
so - i'll extend this ?
Comment #9
miro_dietikerYes, that's a good start. Missing is at least:
First, call the sensor a second time and make sure there's no extra log record.
Additionally, with mode "all", make the sensor caching and make sure that on a regular run (with cached result) there's no extra log record.