Uploaded image for project: 'Log4php'
  1. Log4php
  2. LOG4PHP-80

Trying to set unknown properties should result in an exception

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.0.0
    • Code
    • 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

      Attachments

        Activity

          People

            lathspell Christian Brunotte
            lathspell Christian Brunotte
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: