Log4j gurus,

I'm experiencing a strange problem with ObjectRenderer; for a certain
program it only works when I insert them programmatically, but not when they
are configured in the log4j.xml file.

This works fine:

        LoggerRepository rp = LogManager.getLoggerRepository();
        if( rp instanceof Hierarchy ) {
                Hierarchy h = ( Hierarchy ) rp;
                h.addRenderer( javax.telephony.Address.class, new AddressRenderer() );
        } else {
                System.err.println( "Can't add renderer: LoggerRepository is NOT a
Hierarchy" );
        }

But this does *not* work:

        <renderer
                renderedClass="javax.telephony.Address"
                renderingClass="com.onrelay.mbx.jtapi.renderers.AddressRenderer" />

The parsing of the section and instantiation of the renderer works fine
(according to the logs), it's just that when an Address object is logged,
log4j is totally oblivious to the renderer defined for the Address class,
and the toString() method on the implementing object is called instead.

I suspect that the programmatic insertion inserts the renderer on a
different hierarchy or something, but I don't know enough about the
internals of log4j to understand what's going on.

Any help is much appreciated.

--

Thomas





________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs SkyScan
service. For more information on a proactive anti-virus service working
around the clock, around the globe, visit http://www.messagelabs.com
________________________________________________________________________

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to