Re: Log Errors when debug = 0?

2009-08-12 Thread David

Thanks for the tip Martin - I think I've worked it out.

First I overrode the Debugger class in a new class called TDebugger,
which I saved in app/vendors:

App::import('Core', 'Debugger');
class TDebugger extends Debugger {
function handleError($code, $description, $file = null, $line = null,
$context = null) {
// Override this function for custom error handling
}
}

Then I modified AppController::beforeFilter() to load the new
debugger:

App::import('Vendor', 'TDebugger');
Debugger::invoke(new TDebugger());

Seems to work - if anyone can think of a better way of doing it let me
know :)

David

On Aug 11, 8:03 am, Martin Westin martin.westin...@gmail.com wrote:
 libs/error.php doesn't deal with php errors. I was poking around there
 myself earlier.

 What I did find was:
 Cake sets up how much php should report on lines 293-312 of libs/
 configure.php
 To setup your own error handler you can sneak a peek at lines 570 and
 165-232 of libs/debugger.php. This is where Cake captures PHP errors
 and prints them with nice contexts and things.

 I imagine you can override these settings and display or log PHP
 errors as you wish even without modifying the Core.

 (all line numbers are for the current release version 1.2.4)

 /Martin

 On Aug 11, 3:44 pm, Rick will...@gmail.com wrote:

  Look in the cake/libs/error.php class.  You may be able to override
  something there and make log output work.  I don't know where in the
  hierarchy of cake you would need to put the override to make it work.
  Maybe some expert can contribute here.

  Rick

  On Aug 11, 3:31 am, bram brammele...@gmail.com wrote:

   I do know it's possible to write all cake debugging and error info to
   the log file. But I don't know how to enable it without a small
   modification in the cake source code. I've asked a similar question a
   couple of days ago, but no replies

  http://groups.google.com/group/cake-php/msg/05dfde6ad7ebfed2?hl=en

   Bram

   On Aug 10, 11:22 pm, David sirdavid...@gmail.com wrote:

I would like to silently write errors to error.log when in production
mode. It would be useful to catch anything going wrong that I hadn't
previously noticed.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Log Errors when debug = 0?

2009-08-12 Thread Martin Westin


That doesn't look too bad... quite nice actually. I might have to give
it a try some day soon.

thanks.


On Aug 12, 9:45 am, David sirdavid...@gmail.com wrote:
 Thanks for the tip Martin - I think I've worked it out.

 First I overrode the Debugger class in a new class called TDebugger,
 which I saved in app/vendors:

 App::import('Core', 'Debugger');
 class TDebugger extends Debugger {
         function handleError($code, $description, $file = null, $line = null,
 $context = null) {
                 // Override this function for custom error handling
         }

 }

 Then I modified AppController::beforeFilter() to load the new
 debugger:

 App::import('Vendor', 'TDebugger');
 Debugger::invoke(new TDebugger());

 Seems to work - if anyone can think of a better way of doing it let me
 know :)

 David

 On Aug 11, 8:03 am, Martin Westin martin.westin...@gmail.com wrote:



  libs/error.php doesn't deal with php errors. I was poking around there
  myself earlier.

  What I did find was:
  Cake sets up how much php should report on lines 293-312 of libs/
  configure.php
  To setup your own error handler you can sneak a peek at lines 570 and
  165-232 of libs/debugger.php. This is where Cake captures PHP errors
  and prints them with nice contexts and things.

  I imagine you can override these settings and display or log PHP
  errors as you wish even without modifying the Core.

  (all line numbers are for the current release version 1.2.4)

  /Martin

  On Aug 11, 3:44 pm, Rick will...@gmail.com wrote:

   Look in the cake/libs/error.php class.  You may be able to override
   something there and make log output work.  I don't know where in the
   hierarchy of cake you would need to put the override to make it work.
   Maybe some expert can contribute here.

   Rick

   On Aug 11, 3:31 am, bram brammele...@gmail.com wrote:

I do know it's possible to write all cake debugging and error info to
the log file. But I don't know how to enable it without a small
modification in the cake source code. I've asked a similar question a
couple of days ago, but no replies

   http://groups.google.com/group/cake-php/msg/05dfde6ad7ebfed2?hl=en

Bram

On Aug 10, 11:22 pm, David sirdavid...@gmail.com wrote:

 I would like to silently write errors to error.log when in production
 mode. It would be useful to catch anything going wrong that I hadn't
 previously noticed.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Log Errors when debug = 0?

2009-08-11 Thread bram

I do know it's possible to write all cake debugging and error info to
the log file. But I don't know how to enable it without a small
modification in the cake source code. I've asked a similar question a
couple of days ago, but no replies

http://groups.google.com/group/cake-php/msg/05dfde6ad7ebfed2?hl=en

Bram

On Aug 10, 11:22 pm, David sirdavid...@gmail.com wrote:
 I would like to silently write errors to error.log when in production
 mode. It would be useful to catch anything going wrong that I hadn't
 previously noticed.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Log Errors when debug = 0?

2009-08-11 Thread Rick

Look in the cake/libs/error.php class.  You may be able to override
something there and make log output work.  I don't know where in the
hierarchy of cake you would need to put the override to make it work.
Maybe some expert can contribute here.

Rick



On Aug 11, 3:31 am, bram brammele...@gmail.com wrote:
 I do know it's possible to write all cake debugging and error info to
 the log file. But I don't know how to enable it without a small
 modification in the cake source code. I've asked a similar question a
 couple of days ago, but no replies

 http://groups.google.com/group/cake-php/msg/05dfde6ad7ebfed2?hl=en

 Bram

 On Aug 10, 11:22 pm, David sirdavid...@gmail.com wrote:

  I would like to silently write errors to error.log when in production
  mode. It would be useful to catch anything going wrong that I hadn't
  previously noticed.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Log Errors when debug = 0?

2009-08-10 Thread David

Hi guys,

I would like to silently write errors to error.log when in production
mode. It would be useful to catch anything going wrong that I hadn't
previously noticed.

Any ideas for a way to do this?

Thanks!

David
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Log Errors when debug = 0?

2009-08-10 Thread JamesF

i sometimes set a global flag in my bootstrap.php

$live = true;

and any error handling has to check and see if($live) is true before
it decides what to do with an error.

http://book.cakephp.org/view/154/Error-Handling


On Aug 10, 5:22 pm, David sirdavid...@gmail.com wrote:
 Hi guys,

 I would like to silently write errors to error.log when in production
 mode. It would be useful to catch anything going wrong that I hadn't
 previously noticed.

 Any ideas for a way to do this?

 Thanks!

 David
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Log Errors when debug = 0?

2009-08-10 Thread JamesF

i sometimes set a global constant in my bootstrap.php

define('LIVE_SITE', true);

and any error handling has to check and see if('LIVE_SITE') is true
before
it decides what to do with an error.

http://book.cakephp.org/view/154/Error-Handling

On Aug 10, 5:22 pm, David sirdavid...@gmail.com wrote:
 Hi guys,

 I would like to silently write errors to error.log when in production
 mode. It would be useful to catch anything going wrong that I hadn't
 previously noticed.

 Any ideas for a way to do this?

 Thanks!

 David
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Log Errors when debug = 0?

2009-08-10 Thread joshua
It would be better if it can be integrated into cake frame configure.

On Tue, Aug 11, 2009 at 10:05 AM, JamesF usaexportexpe...@gmail.com wrote:


 i sometimes set a global constant in my bootstrap.php

 define('LIVE_SITE', true);

 and any error handling has to check and see if('LIVE_SITE') is true
 before
 it decides what to do with an error.

 http://book.cakephp.org/view/154/Error-Handling

 On Aug 10, 5:22 pm, David sirdavid...@gmail.com wrote:
  Hi guys,
 
  I would like to silently write errors to error.log when in production
  mode. It would be useful to catch anything going wrong that I hadn't
  previously noticed.
 
  Any ideas for a way to do this?
 
  Thanks!
 
  David
 



-- 
Thanks
Joshua
5span.com https://www.5span.com

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Log Errors when debug = 0?

2009-08-10 Thread David

I see what you mean, but I also want to be able to log the PHP errors
(not the framework errors) that come up. As far as I understand, the
ErrorHandler class only deals with framework errors, doesn't it?

On Aug 10, 7:05 pm, JamesF usaexportexpe...@gmail.com wrote:
 i sometimes set a global constant in my bootstrap.php

 define('LIVE_SITE', true);

 and any error handling has to check and see if('LIVE_SITE') is true
 before
 it decides what to do with an error.

 http://book.cakephp.org/view/154/Error-Handling

 On Aug 10, 5:22 pm, David sirdavid...@gmail.com wrote:

  Hi guys,

  I would like to silently write errors to error.log when in production
  mode. It would be useful to catch anything going wrong that I hadn't
  previously noticed.

  Any ideas for a way to do this?

  Thanks!

  David
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---