I want to use Zend Framwork's Log mechanism as a separated component,that means all I want from ZF is just the Log, How can I do this?
How to use Zend Log as a separated component?
1k views Asked by castiel At
2
There are 2 answers
0
On
Whenever I want to use individual components from Zend Framework I simply include a small file called zend_setup.php
that contains the following three lines of code:
set_include_path( '/Users/me/workspace/proj_name/library' . PATH_SEPARATOR . get_include_path());
require_once( '/Users/me/workspace/proj_name/library/Zend/Loader/Autoloader.php' );
Zend_Loader_Autoloader::getInstance();
This is probably not as efficient as issuing explicit require_once()
statements, but I like the convenience it offers. For example, you may very quickly decide you also want to utilize Zend_Log_Writer_Firebug()
and Zend_Log_Writer_Mail()
. Using the autoloader avoids having to write all those additional require_once()
statements.
According to these two pages
Zend_Log
requiresZend_Exception
and the followingWhat this means is that you really only need the following from the framework itself
You should then be able to use the logger as a stand-alone component. Just add the
library
folder in the list above to your include path (Zend Framework components rely on this)