On Fri, Nov 23, 2012 at 4:38 PM, businessdad
<[email protected]> wrote:
> I had some issues with a client where Log4php is installed. He got the error
> class LoggerHierarchy not found, and I found out that, for some reasons, the
> Autoloader could not load the file.
>
> Unfortunately, as it often happens in production environments, PHP warning
> were suppressed, therefore nobody realised that the file could not be loaded
> until I noticed it. I'm therefore asking why the Autoloader uses include to
> load the classes, which simply raises a warning and carries on in case of
> failure, rather than require, which would stop the execution and informing
> that the file could not be loaded.
>
> Personally, I think that require should be used, as, if I ask for a class, I
> need that class and, therefore, the file must be loaded for the caller to
> work properly. Failing silently is not an option, as it simply causes issues
> later on, making debugging much more difficult.

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?

Cheers
Christian

Reply via email to