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 "Michael Kuenzli (JIRA)" <ji...@apache.org> on 2009/04/28 11:41:30 UTC

[jira] Created: (LOG4PHP-28) LoggerAppenderConsole doesn't write to STDERR

LoggerAppenderConsole doesn't write to STDERR
---------------------------------------------

                 Key: LOG4PHP-28
                 URL: https://issues.apache.org/jira/browse/LOG4PHP-28
             Project: Log4php
          Issue Type: Bug
          Components: Code
            Reporter: Michael Kuenzli


How to reproduce:
1. Take the console example from apache-log4php/trunk/src/examples/php/ 
and change the following line in console.properties
log4php.appender.console.target = STDOUT
to
log4php.appender.console.target = STDERR

2. Run console.php.
-> Effect: no output to STDERR

Solution:
Index: trunk/src/main/php/appenders/LoggerAppenderConsole.php
===================================================================
--- trunk/src/main/php/appenders/LoggerAppenderConsole.php	(revision 769273)
+++ trunk/src/main/php/appenders/LoggerAppenderConsole.php	(working copy)
@@ -76,7 +76,7 @@
         if ($v == self::STDOUT || strtoupper($v) == 'STDOUT') {
             $this->target = self::STDOUT;
         } elseif ($v == self::STDERR || strtoupper($v) == 'STDERR') {
-            $target = self::STDERR;
+            $this->target = self::STDERR;
         } else {
             LoggerLog::debug("Invalid target. Using '".self::STDOUT."' by default.");        
         }


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


[jira] Updated: (LOG4PHP-28) LoggerAppenderConsole doesn't write to STDERR

Posted by "Michael Kuenzli (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LOG4PHP-28?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Kuenzli updated LOG4PHP-28:
-----------------------------------

    Attachment: LoggerAppenderConsole.patch

> LoggerAppenderConsole doesn't write to STDERR
> ---------------------------------------------
>
>                 Key: LOG4PHP-28
>                 URL: https://issues.apache.org/jira/browse/LOG4PHP-28
>             Project: Log4php
>          Issue Type: Bug
>          Components: Code
>            Reporter: Michael Kuenzli
>         Attachments: LoggerAppenderConsole.patch
>
>   Original Estimate: 0.08h
>  Remaining Estimate: 0.08h
>
> How to reproduce:
> 1. Take the console example from apache-log4php/trunk/src/examples/php/ 
> and change the following line in console.properties
> log4php.appender.console.target = STDOUT
> to
> log4php.appender.console.target = STDERR
> 2. Run console.php.
> -> Effect: no output to STDERR
> Solution:
> Index: trunk/src/main/php/appenders/LoggerAppenderConsole.php
> ===================================================================
> --- trunk/src/main/php/appenders/LoggerAppenderConsole.php	(revision 769273)
> +++ trunk/src/main/php/appenders/LoggerAppenderConsole.php	(working copy)
> @@ -76,7 +76,7 @@
>          if ($v == self::STDOUT || strtoupper($v) == 'STDOUT') {
>              $this->target = self::STDOUT;
>          } elseif ($v == self::STDERR || strtoupper($v) == 'STDERR') {
> -            $target = self::STDERR;
> +            $this->target = self::STDERR;
>          } else {
>              LoggerLog::debug("Invalid target. Using '".self::STDOUT."' by default.");        
>          }

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


[jira] Resolved: (LOG4PHP-28) LoggerAppenderConsole doesn't write to STDERR

Posted by "Knut Urdalen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LOG4PHP-28?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Urdalen resolved LOG4PHP-28.
---------------------------------

       Resolution: Fixed
    Fix Version/s: 2.0
         Assignee: Knut Urdalen

Thanks Michael!

I've added your patch in this changeset:
http://svn.apache.org/viewvc?view=rev&revision=769355

However I noticed that at least with PHP 5.2.8 when configuring:
log4php.appender.console.target = STDERR

the parse_ini_file() in LoggerPropertyConfigurator is actually converting STDERR to an invalid resource for some reason (var_dump yield "Resource id #3" while is_resource() returns false...).

The workaround is to enclose the property value with quotation marks like this:
log4php.appender.console.target = "STDERR"

which should always work.


> LoggerAppenderConsole doesn't write to STDERR
> ---------------------------------------------
>
>                 Key: LOG4PHP-28
>                 URL: https://issues.apache.org/jira/browse/LOG4PHP-28
>             Project: Log4php
>          Issue Type: Bug
>          Components: Code
>            Reporter: Michael Kuenzli
>            Assignee: Knut Urdalen
>             Fix For: 2.0
>
>         Attachments: LoggerAppenderConsole.patch
>
>   Original Estimate: 0.08h
>  Remaining Estimate: 0.08h
>
> How to reproduce:
> 1. Take the console example from apache-log4php/trunk/src/examples/php/ 
> and change the following line in console.properties
> log4php.appender.console.target = STDOUT
> to
> log4php.appender.console.target = STDERR
> 2. Run console.php.
> -> Effect: no output to STDERR
> Solution:
> Index: trunk/src/main/php/appenders/LoggerAppenderConsole.php
> ===================================================================
> --- trunk/src/main/php/appenders/LoggerAppenderConsole.php	(revision 769273)
> +++ trunk/src/main/php/appenders/LoggerAppenderConsole.php	(working copy)
> @@ -76,7 +76,7 @@
>          if ($v == self::STDOUT || strtoupper($v) == 'STDOUT') {
>              $this->target = self::STDOUT;
>          } elseif ($v == self::STDERR || strtoupper($v) == 'STDERR') {
> -            $target = self::STDERR;
> +            $this->target = self::STDERR;
>          } else {
>              LoggerLog::debug("Invalid target. Using '".self::STDOUT."' by default.");        
>          }

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