Log4php
  1. Log4php
  2. LOG4PHP-80

Trying to set unknown properties should result in an exception

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0.0
    • Component/s: Code
    • Labels:
      None

      Description

      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

        Activity

        Hide
        Christian Brunotte added a comment -

        fixed in svn

        Show
        Christian Brunotte added a comment - fixed in svn

          People

          • Assignee:
            Christian Brunotte
            Reporter:
            Christian Brunotte
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development