Bug #17785 [Opn->Asn]: Composite Logger Opens all sub-loggers
| From: | jon@php.net | Date: | Tue, 24 Aug 2010 06:25:04 +0000 |
| Subject: | Bug #17785 [Opn->Asn]: Composite Logger Opens all sub-loggers | ||
| References: | 1 | Groups: | php.pear.bugs |
| Request: | Send a blank email to pear-bugs+get-4650@lists.php.net to get a copy of this message | ||
Edit report at http://pear.php.net/bugs/bug.php?id=17785&edit=1
ID: 17785
Updated by: jon@php.net
Reported By: wj dot belanger at gmail dot com
Summary: Composite Logger Opens all sub-loggers
-Status: Open
+Status: Assigned
Type: Bug
Package: Log
Operating System: Ubuntu/10.04 (lucid)
Package Version: 1.12.1
PHP Version: 5.3.2
-Assigned To:
+Assigned To: jon
Roadmap Versions:
New Comment:
-Status: Open
+Status: Assigned
-Assigned To:
+Assigned To: jon
Previous Comments:
------------------------------------------------------------------------
[2010-08-22 03:24:52] kiyote
Description:
------------
The composite logger opens all sub-loggers on the open command,
regardless of whether those loggers would log a message.
The code below shows a window log handler being created with a log level
of 'alert', and a composite handler consisting of a the single handler.
Since the composite handler has a default log level (info), then the
logging call with info level will cause the composite handler to call
the open method. This in turn calls the open method for all sub-loggers
- which in this case consists of the window log handler - regardless of
whether or not they will print the message.
The end result is a javascript window being opened, with no log messages
contained within.
Test script:
---------------
<?php
include("Log.php");
$sub = &Log::singleton("win", "Log Window", "ident", array(),
PEAR_LOG_ALERT);
$log = &Log::singleton("composite", "", "ident2");
$log->addChild($sub);
$log->info("Don't show me");
?>
Expected result:
----------------
No window pops up.
Actual result:
--------------
A javascript window pops up with no messages contained.
------------------------------------------------------------------------
--
Edit this bug report at http://pear.php.net/bugs/bug.php?id=17785&edit=1