Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Logging from Vendor classes in CakePHP

Tags:

cakephp

I have a CakePHP application that uses a number of vendor classes, including one to handle email. We're having some issues with emails not arriving, so we want to add a log message every time an email gets sent. The obvious place to do that is in the send function of the email class, but $this->log doesn't work, since the vendor object isn't built on the CakePHP one.

Is there anyway to access the CakePHP logging system from a non-CakePHP class?

Thanks in advance

like image 665
MattBelanger Avatar asked Mar 31 '26 02:03

MattBelanger


1 Answers

I found a hint at this on another site. The solution is

Debugger::log()

Some further details, since I ran in to a problem while doing this. Your debug level needs to be greater than zero or you get a white screen.

like image 55
MattBelanger Avatar answered Apr 02 '26 23:04

MattBelanger