logging-log4php-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Florian Semm <florian.s...@gmx.de>
Subject Re: trigger errors
Date Sun, 13 Nov 2011 13:39:47 GMT
Am 13.11.2011 10:54, schrieb Ivan Habunek:
> On 13 November 2011 09:25, Florian Semm<florian.semm@gmx.de>  wrote:
>> if we expect in a configuration an attribute like "name" or "class" and we
>> got nothing, we should call this trigger_error() function.
>> i haven't seen that the LoggerConfigurator class validate the configuration.
>> The configurator still triggers errors if the config is incomplete.
> You are right, of course. I have fixed this in trunk. There is warning
> triggered now if 'name' or 'class' attributes are missing in the
> appender node. Please update and retest.
> I have also tried to make error messages more meaningful where possible.
> If you're interested in how it works under the hood: there are now two
> stages in configuring from an XML file:
> 1. An Adapter object converts the XML file to a PHP array. The
> configuration values are not validated at this point, just the XML
> structure. For example, the missing 'name' node should have been
> reported here.
> 2. A Configurator object applies the configuration from the array to
> the log4php hierarchy. Everything is validated.
> It's the same for properties (ini) config files. They use a different
> Adapter, but the same Configurator.
> If you want to see what the translated configuration looks like, run:
> $conf = new LoggerConfigurator();
> print_r($conf->parse('log4php.xml'));
> Regards,
> Ivan
the configurator and the adapters are good examples for separation of 
concerns. :)

the configurator-test only has tests for two error-cases, happy-path and 
default-setup. i would like to write some addional testcases.



View raw message