I'm made a patch adding support for adding new appender
classes dynamically (as log4j will let you). I'm not
interested in modifying the sourcecode for log4cpp each
time I want to add a new appender (well, I guess I did
now though... ;) ).
I've just added a new class,
PropertyConfiguratorDynamic that extends
PropertyConfiguratorImpl, overloading the
instantiateAppender method.
Writing a new appender is just like writing an old one,
with one exception:
The new appender must define a function like this:
<pre>
extern "C" {
log4cpp::Appender* getInstance(const std::string
&amp; name) {
log4cpp::Appender* a =
StatusBarAppender::getAppender(name);
return a;
}
}
</pre>
that is linked into the shared library (I put it in the
same file as the source of the class file for the
appender).
This function is used for instantiating an instance of
the appender class.
I've changed PropertyConfigurator to use
PropertyConfiguratorDynamic in stead of
PropertConfiguratorImpl. PCDynamic will call PCImpl if
it's unable to load the appender dynamically, so it's
backwards compatible.
Add support for dunamically loaded appender classes.
Logged In: NO
hi
The intent is great, but the way it done is not quite right, IMO. As part of related effort I added factories for layouts, appenders. Next will be replacing PropertyConfigurator to one that will relay on factories.