You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Ceki Gülcü <ce...@qos.ch> on 2003/05/22 10:52:12 UTC

Re: how to register 2 ObjectRenderers for one class (for 2 Appenders)

At 11:48 AM 5/22/2003 +0200, you wrote:
>thanks.
>
>I just walked a while thru the manual and the code.
>If I understand it, I can figure a workaround to bypass the problem.  Please
>let me know if this can work.
>
>I can create my own Layout class that have method 'setRendererObject'.  In
>its 'format' method, this layout won't call the
>"event.getRenderedMessage()", instead it will call
>"privateOR.doRender(event.getMessage())".
>
>If one want to generalize this solution he can hold a private RendererMap in
>the Layout that can override ORs that were registered in the general
>RendererMap.

That's the general idea. With a little work, you can program your way to a 
solution. However, achieving the same effect  with a config file is a 
different matter.

>The rest is simple.  In the system, I will only register OR1, this will
>serve appender1.  For appender2, I will use my custom Layout, not before I
>perform customLayout.setRendererObject(OR2);


--
Ceki  For log4j documentation consider "The complete log4j manual"
       ISBN: 2970036908  http://www.qos.ch/shop/products/clm_t.jsp 


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org