在我的 CakePHP 2.2 应用程序中,我在 debug.log 文件中得到一个“通知”。我几乎每天都会收到此警告,但我无法解决问题。所以我需要在 debug.log 中写一些额外的数据。但是我想在这个“通知”出现时写下那个数据。
例如,我收到此通知:
2012-09-26 19:53:01 Notice: Notice (8):
Trying to get property of non-object in
[/var/www/vhosts/example.com/app/View/Tools/index.ctp, line 42]
Trace:
include - APP/View/Tools/index.ctp, line 42
View::_evaluate() - CORE/Cake/View/View.php, line 920
View::_render() - CORE/Cake/View/View.php, line 883
View::render() - CORE/Cake/View/View.php, line 475
Controller::render() - CORE/Cake/Controller/Controller.php, line 957
Dispatcher::_invoke() - CORE/Cake/Routing/Dispatcher.php, line 193
Dispatcher::dispatch() - CORE/Cake/Routing/Dispatcher.php, line 161
[main] - APP/webroot/index.php, line 96
发生此通知时,我想将所有会话变量添加到 debug.log 文件中。
我怎样才能做到这一点?
我可以改变lib/Cake/Log/Cakelog.php
我应该写什么以及在哪里写?
编辑:我粘贴相关的代码片段:
39 <?php if ($auth) { ?>
40 <form class="well" >
41
42 <?php if (isset($user->profile_url)) {
43 echo '<img src="'.$user->profile_url.'" width="48" height="48"/>';
44 } ?>
45
46 <strong><?php echo $user->screen_name; if (isset($user->name)) { echo " (" . $user->name . ")"; } ?></strong><br/>
47 <small><?php if (isset($user->description)) { echo $user->description; } ?> </small><br/>
48 <small><?php if (isset($user->url)) { echo $user->url; } ?> </small><br/>
49 <br/>