Having problems logging to the console using log
from within an onSaveEntry
or onSaveUser
event. Just a simple test below, but will be critical for error logs.
public function init()
{
parent::init();
BusinessLogicPlugin::log('init');
craft()->on('entries.saveEntry', function(Event $event)
{
Craft::log('onSaveEntry');
BusinessLogicPlugin::log('onSaveEntry');
});
}
'init' gets logged fine, but not 'onSaveEntry'. I seem to be able to log other events fine, like plugins.loadPlugins
. I have also confirmed that the event is firing via other tests. Is the log
function not available when the onSaveEntry
event fires? Scope issue? bug? Or am I missing something else? Thanks.
onSaveEntry
is definately firing. I placed anecho $event->params['entry']->id
which threw an exception but at least output the id. I'm guessing either a scope issue orlog
has not been initialized.