记录当前文件名

Joe*_*ith 0 cakephp

有没有办法记录文件名/类名/功能和/或行号,在哪里$this->log调用?

我在$this->log或的文档中找不到这个CakeLog::write ().

Old*_*ool 5

是的,您可以使用默认的PHP常量.例如:

CakeLog::write('debug', 'Oops, something went wrong in ' .
    __FILE__ . ' on line' . __LINE__ . ' within the class ' . get_class()
);
Run Code Online (Sandbox Code Playgroud)

这应该会为您提供所需的所有信息.