Welcome Guest, Not a member yet? Register   Sign In
log4php integration to CI

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 :

* Created on 16/05/2010
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates


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:

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

[eluser]Tudip Technologies[/eluser]
Hi Nani,
Please look at this small blog entry with sample code:



for better and clear solution refer the below link


Theme © iAndrew 2016 - Forum software by © MyBB