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

[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


Messages In This Thread
log4php integration to CI - by El Forum - 06-05-2010, 11:43 AM
log4php integration to CI - by El Forum - 05-10-2012, 11:37 PM
log4php integration to CI - by El Forum - 07-02-2013, 12:55 AM



Theme © iAndrew 2016 - Forum software by © MyBB