On Sun, 9 Jul 2006 16:58:54 +1000
"Ryan Blunden" <[EMAIL PROTECTED]> wrote:
> Hey mate,
>
> Ryno here from the CakePHP Google group.
>
> Just wondering if you've come up with a solution for logging application
> events to your database? I'm currently building an app that needs the
> same thing so please be sure to let me know either via email or the
> group how you got on.
Hi.
I've come with a solution that i think will work, although i haven't
implemented it yet.
Logging will be done in two steps: First, a Log class that will collect
log messages like Log::write('some message') or Log::write(LOG_DEBUG,
'some message') (this will simply stack messages in an array). This can
occur seamlessly anywhere i want (controller, model, components, views,
vendors, whatever). Second, in AppController::afterFilter() i will dump
the stack of log messages to the DB. There i can access the Session
component to get info on the logged-in user.
For this to work, you must make sure that AppController::afterFilter() is
always called, i.e., no die() in the middle of the action. I overrode
Controller::redirect() to call afterFilter() before redirecting and die
afterwords.
Hope this helps.
Best regards.
--
Gonçalo Marrafa <[EMAIL PROTECTED]>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---