从CakePHP中的供应商类记录(Logging from Vendor classes in CakePHP)

编程入门 行业动态 更新时间:2024-10-27 10:19:32
从CakePHP中的供应商类记录(Logging from Vendor classes in CakePHP)

我有一个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.

更多推荐

本文发布于:2023-08-07 19:57:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1465666.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:供应商   CakePHP   Logging   classes   Vendor

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!