[eluser]sramos[/eluser]
Hi all!
I made an integration of log4php, im not sure its the best way and wanted some advices and scolds about the thing i did..
I put the apache-log4php-2.0.0-incubating as a library and added a wrapper php library class :
Code:
<?php
/*
* Created on 16/05/2010
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
include_once('apache-log4php-2.0.0-incubating/src/main/php/Logger.php');
Logger::configure('log4php.properties');
class Log4php {
function Log4php(){
$logger = Logger::getLogger("Log4php");
//$logger->info("llamado a Log4php");
}
}
?>
I call it on controllers and models as a normal library class and use de logger as the normal way:
Code:
private $logger; //logger
function A() { // the constructor method of A class
parent::Controller(); //for example a Controller
$this->load->library('log4php/Log4php.php'); // the calling to my dummy wrapper class
$this->logger = Logger::getLogger("A"); // the logger of A class
}
function method1(){
...
$this->logger->error('Exception:'.$this->mCException); // logging somthing
}
The [code]log4php.properties[code] is under my application folder
It works as i expected it to work, but im not sure is the correct way to do it.
If someone wants to throw me roses or tomatos its welcome