Re: [PEPr] Proposal for Logging::Log4P
| From: | Arnaud Limbourg | Date: | Mon, 19 Dec 2005 06:20:23 +0000 |
| Subject: | Re: [PEPr] Proposal for Logging::Log4P | ||
| References: | 1 2 3 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-40785@lists.php.net to get a copy of this message | ||
> ... which is an essential way you hook in log4j (well, the way I do it
> through the Apache Commons Logging interface) in Java. Thus, for PHP I
> went with a static method approach, and the Log4P class takes care of
> managing log instances according to the calling class (I see
> $GLOBALS['log']->debug() type stuff in many codebases, and I don't like
> it!). Log4P uses a trick that I hope doesn't change in the PHP
> codebase: if you call a static method from within a PHP object instance,
> inside the static method $this will still be set to the calling
> instance. This makes the Log4P approach even easier than Java-style
> logging, since you can make logging into a one-liner, with no instance
> binding and configuration separate from your application code:
Thanks for the explanation. Have you tested it under PHP5 ?
Arnaud.