You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-user@logging.apache.org by Rob Outar <ro...@ideorlando.org> on 2010/11/18 21:01:16 UTC
RE: Can't find custom appender
I created a custom appender that extends RollingFileAppender, my class is
located in a "test" namespace and the class name is TestAppender, in my xml
file I have:
<appender name="FILE" class="test. TestAppender">
But when I run, log4cxx says it cannot find appender. what am I missing?
Best regards,
Rob
RE: Can't find custom appender
Posted by Rob Outar <ro...@ideorlando.org>.
Thanks Curt, that was it... I figured it out early this morning when I
looked at the source and it was looking in a map for the class, then in
RollingFileAppender I saw some sort of registration going on. I added that
to the code and now it works! Wish I had looked at the source sooner, would
have saved me a few days of random guessing.
--Rob
-----Original Message-----
From: Curt Arnold [mailto:curt.arnld@gmail.com] On Behalf Of Curt Arnold
Sent: Friday, November 19, 2010 8:45 AM
To: Log4CXX User
Subject: Re: Can't find custom appender
The likely suspect is that your appender is not being added to the registry
of known appenders before the configuration is processed.
Your appender should have a macro expansion like:
IMPLEMENT_LOG4CXX_OBJECT(DailyRollingFileAppender)
that contains the registration code. You can set a breakpoint there
(depending on your debugger, you may need to manually expand) and on the
configurator and see the order that they fire and whether the registration
code gets called at all.
If you have built your appender in a DLL or shared library, are you forcing
the library to load to trigger the registration?
On Nov 18, 2010, at 2:01 PM, Rob Outar wrote:
> I created a custom appender that extends RollingFileAppender, my class is
located in a "test" namespace and the class name is TestAppender, in my xml
file I have:
>
> <appender name="FILE" class="test. TestAppender">
>
> But when I run, log4cxx says it cannot find appender. what am I missing?
>
> Best regards,
>
> Rob
Re: Can't find custom appender
Posted by Curt Arnold <ca...@apache.org>.
The likely suspect is that your appender is not being added to the registry of known appenders before the configuration is processed.
Your appender should have a macro expansion like:
IMPLEMENT_LOG4CXX_OBJECT(DailyRollingFileAppender)
that contains the registration code. You can set a breakpoint there (depending on your debugger, you may need to manually expand) and on the configurator and see the order that they fire and whether the registration code gets called at all.
If you have built your appender in a DLL or shared library, are you forcing the library to load to trigger the registration?
On Nov 18, 2010, at 2:01 PM, Rob Outar wrote:
> I created a custom appender that extends RollingFileAppender, my class is located in a “test” namespace and the class name is TestAppender, in my xml file I have:
>
> <appender name="FILE" class="test. TestAppender">
>
> But when I run, log4cxx says it cannot find appender… what am I missing?
>
> Best regards,
>
> Rob