You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4php-dev@logging.apache.org by "Christian Hammers (JIRA)" <ji...@apache.org> on 2009/08/07 21:39:14 UTC

[jira] Reopened: (LOG4PHP-59) LoggerAppenderConsole is initialized wrong

     [ https://issues.apache.org/jira/browse/LOG4PHP-59?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Christian Hammers reopened LOG4PHP-59:
--------------------------------------


> r801073 | grobmeier | 2009-08-05 08:13:03 +0200 (Mi, 05. Aug 2009) | 1 Zeile
> LOG4PHP-59: LoggerAppenderConsole is initialized wrong. Configurator needs to take care for activateOptions themselve. 

Hm, wait a minute. Now it doesn't work anymore! :) 

Either you accidently mixed up the booleans when assigning a value to $this->closed in activateOptions() or you wanted to leave the file descriptors closed for most of the time and only reopen them in append(). Then the reopening is missing there.

As, at least for the console appender, there is no benefit in closing it every time (it won't get rotated by logrotate or similar), I would propsed the following fix:

src/main/php/appenders/LoggerAppenderConsole.php in activateOptions()
OLD:              $this->closed = (bool)($this->fp === false);
CURRENT:   $this->closed = (bool)is_resource($this->fp);
NEW:             $this->closed = (bool)is_resource($this->fp) === false;


> LoggerAppenderConsole is initialized wrong
> ------------------------------------------
>
>                 Key: LOG4PHP-59
>                 URL: https://issues.apache.org/jira/browse/LOG4PHP-59
>             Project: Log4php
>          Issue Type: Bug
>          Components: Code
>    Affects Versions: 2.2
>            Reporter: Christian Hammers
>             Fix For: 2.0
>
>
> Hello
> Using    define('LOG4PHP_CONFIGURATOR_CLASS', 'LoggerConfiguratorBasic');   is supposed to configure
> log4php so that it prints on stdout. That currently does not happen as the $fp variable of the LoggerAppenderConsole
> class is never initialized via the setTarget() method.
> The LoggerConfiguratorInit does this with e.g. "log4php.appender.console.target = STDOUT" but here, too, I would
> strongly suggest making stdout the default!
> bye,
> -christian-
> Index: src/main/php/appenders/LoggerAppenderConsole.php
> ===================================================================
> --- src/main/php/appenders/LoggerAppenderConsole.php    (Revision 797819)
> +++ src/main/php/appenders/LoggerAppenderConsole.php    (Arbeitskopie)
> @@ -51,7 +51,7 @@
>          * @var mixed the resource used to open stdout/stderr
>          * @access private         
>          */
> -       protected $fp = false;
> +       protected $fp = STDOUT;
>  
>         /**
>          * Set console target.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.