logging-log4php-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christian Hammers (JIRA)" <j...@apache.org>
Subject [jira] Created: (LOG4PHP-80) Trying to set unknown properties should result in an exception
Date Tue, 08 Sep 2009 23:46:57 GMT
Trying to set unknown properties should result in an exception
--------------------------------------------------------------

                 Key: LOG4PHP-80
                 URL: https://issues.apache.org/jira/browse/LOG4PHP-80
             Project: Log4php
          Issue Type: Bug
          Components: Code
            Reporter: Christian Hammers


While it's arguable if logging problems during the program execution should or should not
terminate the program, I'm strongly in favour of raising an exception if the properties file
contains illegal options.
Currently there is not even a warning if the user makes a typo!

--- src/main/php/LoggerReflectionUtils.php      (Revision 812666)
+++ src/main/php/LoggerReflectionUtils.php      (Arbeitskopie)
@@ -107,8 +112,7 @@
                $method = "set" . ucfirst($name);

                if(!method_exists($this->obj, $method)) {
-                       // no such setter method
-                       return;
+                       throw new Exception("Error setting log4php property $name to $value:
no method $method in class ".get_class($this->obj)."!");
                } else {
                        return call_user_func(array($this->obj, $method), $value);
                }

The error then looks like:
  Exception: Error setting log4php property categoryPrefixxing to 1: no method setCategoryPrefixxing
in class LoggerLayoutTTCC! in ...


bye,

-christian-

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


Mime
View raw message