How do you put Zend_Log into bootstrap correctly? - 2

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How do you put Zend_Log into bootstrap correctly? - 2

allergic
How do you put Zend_Log into bootstrap correctly?  This code works fine by itself:


Websites\akrabat\application\views\scripts\index\edit.phtml - This works!
<?php

$writer = new Zend_Log_Writer_Stream('../var/logs/log.txt'); // Websites/akrabat/var/logs/
$logger = new Zend_Log($writer);
$logger->log('message to yoda', Zend_Log::EMERG);

?>



But when I try to move it into the bootstrap instead then things break on my web application.  What's the proper to way to accomplish this?
Here's some example codes: 
And I'm aware that neither zf_log.txt and log.txt is used entirely everywhere in the examples. 
It's remnants of various testing they aren't the problem and I'm using log.txt only on my LIVE version.


Edit view page
http://pastebin.com/m62377a84

Bootstrap file
http://pastebin.com/m763b14bd


Reply | Threaded
Open this post in threaded view
|

Re: How do you put Zend_Log into bootstrap correctly? - 2

SpiffyJr

W Itch wrote
How do you put Zend_Log into bootstrap correctly?  This code works fine by
itself:


Websites\akrabat\*application*\views\scripts\index\*edit.phtml* - This
works!

<?php

$writer = new Zend_Log_Writer_Stream('../var/logs/log.txt'); //
Websites/akrabat/var/logs/
$logger = new Zend_Log($writer);
$logger->log('message to yoda', Zend_Log::EMERG);

?>




But when I try to move it into the bootstrap instead then things break on my
web application.  What's the proper to way to accomplish this?
Here's some example codes:
And I'm aware that neither zf_log.txt and log.txt is used entirely
everywhere in the examples.
It's remnants of various testing they aren't the problem and I'm using *
log.txt* only on my LIVE version.


*Edit view page*
http://pastebin.com/m62377a84

*Bootstrap file*
http://pastebin.com/m763b14bd

What do you mean "it breaks?" Some more information would be helpful. I always initialize my Logger inside the bootstrap so with a little more information maybe I can get you going.
Kyle S
blogs @ www.spiffyjr.me
github @ www.github.com/spiffyjr
follow @ www.twitter.com/spiffyjr
Reply | Threaded
Open this post in threaded view
|

Re: How do you put Zend_Log into bootstrap correctly? - 2

Peter Warnock-2
In reply to this post by allergic
In your example, the logger follows the return, which will never execute.  The logger should be in a distinct _init method.

Clean up the tabs and get rid of the backslashes.

- pw

On Tue, Sep 29, 2009 at 11:38 AM, W Itch <[hidden email]> wrote:
How do you put Zend_Log into bootstrap correctly?  This code works fine by itself:


Websites\akrabat\application\views\scripts\index\edit.phtml - This works!
<?php

$writer = new Zend_Log_Writer_Stream('../var/logs/log.txt'); // Websites/akrabat/var/logs/
$logger = new Zend_Log($writer);
$logger->log('message to yoda', Zend_Log::EMERG);

?>



But when I try to move it into the bootstrap instead then things break on my web application.  What's the proper to way to accomplish this?
Here's some example codes: 
And I'm aware that neither zf_log.txt and log.txt is used entirely everywhere in the examples. 
It's remnants of various testing they aren't the problem and I'm using log.txt only on my LIVE version.


Edit view page
http://pastebin.com/m62377a84

Bootstrap file
http://pastebin.com/m763b14bd



Reply | Threaded
Open this post in threaded view
|

Re: How do you put Zend_Log into bootstrap correctly? - 2

allergic
Thanks Peter you solved it!  I have full control over the syslog now. :-)

Bootstrap
http://pastebin.com/f788c3a29

Edit view page
http://pastebin.com/f5f45c31f





On Wed, Sep 30, 2009 at 8:05 AM, Peter Warnock <[hidden email]> wrote:
In your example, the logger follows the return, which will never execute.  The logger should be in a distinct _init method.

Clean up the tabs and get rid of the backslashes.

- pw


On Tue, Sep 29, 2009 at 11:38 AM, W Itch <[hidden email]> wrote:
How do you put Zend_Log into bootstrap correctly?  This code works fine by itself:


Websites\akrabat\application\views\scripts\index\edit.phtml - This works!
<?php

$writer = new Zend_Log_Writer_Stream('../var/logs/log.txt'); // Websites/akrabat/var/logs/
$logger = new Zend_Log($writer);
$logger->log('message to yoda', Zend_Log::EMERG);

?>



But when I try to move it into the bootstrap instead then things break on my web application.  What's the proper to way to accomplish this?
Here's some example codes: 
And I'm aware that neither zf_log.txt and log.txt is used entirely everywhere in the examples. 
It's remnants of various testing they aren't the problem and I'm using log.txt only on my LIVE version.


Edit view page
http://pastebin.com/m62377a84

Bootstrap file
http://pastebin.com/m763b14bd