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 "Justin Cherniak (JIRA)" <ji...@apache.org> on 2011/06/28 20:04:17 UTC

[jira] [Commented] (LOG4PHP-143) LoggerConfiguratorPhp does not accept INT constants for appender threshold

    [ https://issues.apache.org/jira/browse/LOG4PHP-143?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13056683#comment-13056683 ] 

Justin Cherniak commented on LOG4PHP-143:
-----------------------------------------

The following patch should fix the issue:

Index: LoggerLevel.php
===================================================================
--- LoggerLevel.php	(revision 1140749)
+++ LoggerLevel.php	(working copy)
@@ -248,7 +248,7 @@
 		if($defaultLevel === null) {
 			return self::toLevel($arg, self::getLevelDebug());
 		} else {
-			if(is_int($arg)) {
+			if(is_numeric($arg)) {
 				switch($arg) {
 					case self::ALL:	return self::getLevelAll();
 					case self::TRACE: return self::getLevelTrace();


> LoggerConfiguratorPhp does not accept INT constants for appender threshold
> --------------------------------------------------------------------------
>
>                 Key: LOG4PHP-143
>                 URL: https://issues.apache.org/jira/browse/LOG4PHP-143
>             Project: Log4php
>          Issue Type: Bug
>            Reporter: Justin Cherniak
>
> When you specify a threshold in a Php configuration file using the typical LoggerLevel::_____ constants (such as LoggerLevel::ALL), the operation fails to set the proper threshold on the appender and it always defaults to DEBUG.
> If you specify a string for the threshold, then it works properly.
> For example:
>   $config['appenders']["email"] = array(
>     'class' => 'LoggerAppenderMailEvent',
>     'to' => $email,
>     'from' => variable_get('site_mail', ini_get('sendmail_from')),
>     'subject' => "log4php event on $hostname",
>     'layout' => $layout,
>     'threshold' => LoggerLevel::FATAL
>   );  
> fails and sets the logger level to DEBUG, while this:
>   $config['appenders']["email"] = array(
>     'class' => 'LoggerAppenderMailEvent',
>     'to' => $email,
>     'from' => variable_get('site_mail', ini_get('sendmail_from')),
>     'subject' => "log4php event on $hostname",
>     'layout' => $layout,
>     'threshold' => 'FATAL'
>   );  
> works properly.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira