我有一个CakePHP应用程序,它使用了许多供应商类,包括一个处理电子邮件的类。 我们遇到了一些电子邮件未到达的问题,因此我们希望每次发送电子邮件时都添加日志消息。 显而易见的地方是电子邮件类的send函数,但$ this-> log不起作用,因为供应商对象不是构建在CakePHP上的。
无论如何从非CakePHP类访问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
最满意答案
我在另一个网站上发现了这个暗示。 解决方案是
Debugger::log()一些进一步的细节,因为我在这样做时遇到了问题。 您的调试级别需要大于零,否则您将获得白屏。
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.
更多推荐
发布评论