The scenario is this one: I have several MIGXdb custom components/classes/tables which I would like to monitor a bit better, so I changed the default processor for updating items a bit and added
$modx->logManagerAction('MIGX action: ' . $task, $classname, $object->get('songid'));
this so far works very well and I can log if a user updates a MIGXdb item, buuut, my error log gets cramped with messages like:
[2013-07-25 16:20:02] (ERROR @ /connectors/system/log.php) Error 42000 executing statement:
Array
(
[0] => 42000
[1] => 1064
[2] => You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '=> 3973)' at line 1
)
[2013-07-25 16:26:43] (ERROR @ /connectors/system/log.php) TimelineSong::load() is not a valid static method.
[2013-07-25 16:26:43] (ERROR @ /connectors/system/log.php) Could not load class: TimelineSong from mysql.timelinesong.
as soon as I open the manager activities manager page (not when saving the migxdb item...)
I changed the file at core/model/modx/processors/system/log/getlist.class.php a bit to not try to getObject if it's not a native modSomething class, so at line 118 I inserted:
if ( strpos($logArray['classKey'], 'mod') !== false ) {
$obj = $this->modx->getObject($logArray['classKey'],$logArray['item']);
} else {
$obj = null;
}
which at least gets rid of the load errors like these:
[2013-07-25 16:26:43] (ERROR @ /connectors/system/log.php) TimelineSong::load() is not a valid static method.
[2013-07-25 16:26:43] (ERROR @ /connectors/system/log.php) Could not load class: TimelineSong from mysql.timelinesong.
but the SQL errors stay.
So the question is, what is the correct way to log actions from a custom component to the manager log?