logging-log4php-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Grobmeier <grobme...@gmail.com>
Subject Re: Usage of LoggerRenderer* clases?
Date Sun, 13 Sep 2009 17:27:37 GMT
Hi,

I think you misunderstood something :-)

Imagine your impl. below, and then the following lines:

$fruit = new Fruit3();
$logger->info($fruit);

The object is identified as a Fruit-Object and then rendered with renderer.
You made the mistake to think that logger-calls WITHIN the fruit would
do something, but thats not the way it works.

I think we need to write some more lines on
http://ci.apache.org/projects/log4php/docs/renderer.html

since i just saw that its not explaingin the correct usage, just the
configuration.

Cheers,
Christian



On Sat, Sep 12, 2009 at 5:27 PM, Christian Hammers <ch@lathspell.de> wrote:
> Hello
>
> How and when are the LoggerRenderer* classes supposed to be used?
> There is not LayoutPattern %-tag for a dump of the object and it does
> not seem to get called for normal logging messages.
>
> The following still just prints "INFO - Hello World!".
>
> bye,
>
> -christian-
>
> ----------------------------------
> log4php.renderer.Fruit3 = FruitRenderer3
>
> log4php.appender.default = LoggerAppenderEcho
> log4php.appender.default.layout = LoggerLayoutSimple
>
> log4php.threshold = DEBUG
> log4php.rootLogger = DEBUG, default
> ------------------------------
>
> ------------------------------------------------------
> require_once dirname(__FILE__).'/../../main/php/Logger.php';
> Logger::configure(dirname(__FILE__).'/../resources/renderer_default.properties');
>
> class Fruit3 {
>    public $test1 = 'test1';
>    public $test2 = 'test2';
>    public $test3 = 'test3';
>
>    public function __construct() {
>        $logger = Logger::getLogger("Fruit3");
>        $logger->info("Hello World!");
>    }
> }
>
> class FruitRenderer3 implements LoggerRendererObject {
>    public function render($o) {
>        return 'Fruit is: '.$o->test1.','.$o->test2.','.$o->test3;
>    }
> }
>
> $fruit = new Fruit3();
> --------------------------------------------------
>

Mime
View raw message