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 Milind Rao <mi...@bellsouth.net> on 2003/07/18 15:19:43 UTC

Rendering an object based on the appender

Is it possible to render an object differently for different appenders?  When I render to a file, I use XML.  This is very 
difficult to read on the console.  On the console, I'd like to use only a small subset of the elements without the tags.  

In the properties file, what I can do now is
    log4j.renderer.my.package.name.MyClassToLog=my.otherpackage.name.MyRendererClass

What I'd like to do is something like
   log4j.appender.A1.renderer.my.package.name.MyClassToLog=my.otherpackage.name.MyConsoleRendererClass
   log4j.appender.A2.renderer.my.package.name.MyClassToLog=my.otherpackage.name.MyFileRendererClass

I have got around it by putting what "doRender" of MyConsoleRendererClass would have done in "toString" of 
MyClassToLog and in my file appender's format method, calling MyFileRendererClass.doRender programatically.



Regards
Milind



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