On 26 November 2011 19:09, Florian Semm <[email protected]> wrote:
> I have implemented this case. But there's a problem: if this will
> implemented in the activateOptions() method, you have to modify all
> appenders which overwrite this method. The createAppenderLayout() method in
> the LoggerConfigurator is a better place. You can call there a method like
> getDefaultLayout() or a static variable.

I can see the problem. I wanted to keep the solution within the
appender class because, if it's defined in the configurator, then the
default layout will not be applied when configuring programatically.

For example, this would not work becuase the layout is not specified:
$app = new LoggerAppenderEcho();
$app->activateOptions();
$app->append("foo");

Maybe we can implement it so default layout is set automatically in
Appender's constructor. The configurator will override the default
layout if it's specified in the config file. This way it works
programatically, but it would be just slightly slower, because the
layout would potentially be set twice.

On the other hand, I don't suppose a lot of people will configure
log4php programatically...

On the third hand, we haven't done any performance tuning at all so
the framework is not very optimised to start with, and this minor
performance penalty will not be detectable. :)

What do you think is the better solution?

Regards,
Ivan

Reply via email to