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 George Uecker <ge...@dot21rts.com> on 2006/11/30 18:17:41 UTC

custom appenders and DOMConfigurator

I have a custom appender that is in a separate library because it has dependencies on some 3rd-party commercial libs.  When I try to configure this appender, the DOMConfigurator says it can't find the class.  What do I have to do to be able to use a custom appender that does NOT reside in the log4cxx lib?

TIA,

George

Re: custom appenders and DOMConfigurator

Posted by Curt Arnold <ca...@apache.org>.
On Nov 30, 2006, at 11:17 AM, George Uecker wrote:

> I have a custom appender that is in a separate library because it  
> has dependencies on some 3rd-party commercial libs.  When I try to  
> configure this appender, the DOMConfigurator says it can't find the  
> class.  What do I have to do to be able to use a custom appender  
> that does NOT reside in the log4cxx lib?
>
> TIA,
>
> George

The problem is likely due to the registration either not occurring or  
occurring after the configuration file is processed.  You somehow  
need to force the appender registration to occur before the  
configuration file is processed.  To figure out how to force the  
order, you would need to know how configuration is triggered  
(explicit call or default configuration) and when (are their logging  
statements in static constructors that are triggering default  
configuration) and to make sure that your appender containing library  
is loaded and its registration code called before that.

How are you forcing your appender library to be loaded?  Does your  
custom library show up when you look at the executable with depends,  
ldd or equivalent?  You might try adding a call to  
MyAppender::registerClass() to your app somewhere that will precede  
the configuration.  Calling registerClass() repeatedly is not harmful  
and should not be all that expensive.

If that doesn't fix the issue, then set break points on the  
registration code and default configuration and check that the  
registration code is being executed and whether it is prior to  
configuration?