On Fri, Nov 23, 2012 at 4:26 PM, Christian grobmeier [via Apache Logging] <
[email protected]> wrote:

> On Fri, Nov 23, 2012 at 4:38 PM, businessdad
> <[hidden email] <http://user/SendEmail.jtp?type=node&node=34941&i=0>>
> wrote:
>
> in my opinion, a logging framework should never cause an application
> to fail. If you do that, it might happen that you reconfigure logging
> in production and - due to an error - you production app stops jus
> because of your logging framework. This is not nice too.
>
> That said, it is actually very easy if you still prefer require
> instead of included.
>
> You could exchange this file:
>
> http://svn.apache.org/repos/asf/logging/log4php/trunk/src/main/php/LoggerAutoloader.php
>
> Another option is to patch log4php in such a way, the user can decide
> between require and include with some kind of ini parameter.
>
> What do you think?


The issue is precisely that, due to the include, Logger carries on also
when required classes are not loaded. Logger cannot work without
LoggerHierarcy, and it fires a fatal error when it tries to instantiate it.
That means backtracing the issue, just to find out that the file was not
loaded.

A Logger is a fundamental part of a system, not a fancy optional one like
an animated menu. If the Logger doesn't work, it *should* raise an error.
Having a website that keeps going on without anyone noticing that something
is broken is worse than having it stopped.

Besides, any call to the Logger would fail anyway, triggering an error,
like in my case. Very simply, it would be easier to be informed of the root
cause (file can't be loaded) straight away, rather than having to figure it
out because some class doesn't exist.

About changing the Autoloader: I've done it already, together with several
other minor changes, but thanks for the suggestion. :)




--
View this message in context: 
http://apache-logging.6191.n7.nabble.com/LoggerAutoloader-Why-include-and-not-require-tp34939p34942.html
Sent from the Log4php - Dev mailing list archive at Nabble.com.

Reply via email to