From: Václav Z. <vha...@gm...> - 2012-07-06 18:21:17
|
On 07/06/2012 07:53 PM, Michel wrote: > Hi, > > I 'm a log4cplus beginer enjoyed by all thé features possible. Do you know where i can find a good tuto about create a custom appender and register it in your lib? Well, there is no such tutorial as far as I know. The code of log4cplus' own appenders might work as one. Take a look at the NullAppender. It shows the absolute minimum that you need to have for a valid appender. Obviously, you will want to change the empty append() function to do something useful. As for registration, take a look at trunk or 1.1.0-RC6 source, qt4debugappender.cxx. It has Qt4DebugAppender::registerAppender() which shows what you need to do to register external appender into log4cplus:: name space. To register your appender into custom namespace use something like this instead (untested): log4cplus::spi::AppenderFactoryRegistry & reg = log4cplus::spi::getAppenderFactoryRegistry (); LOG4CPLUS_REG_PRODUCT (reg, "MyNamespace::", MyAppender, MyNamespace::, log4cplus::spi::AppenderFactory) Your properties files will then be able to instantiate your appender as MyNamespace::MyAppender. > > thanks for the great job Thank you. -- VZ |