You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@logging.apache.org by Pardeep Kumar <pa...@gmail.com> on 2021/11/23 06:02:56 UTC

Query on renderer support in Log4j2

Hi
      I have upgraded log4j1.x to log4j2.x. In log4j2 currenty there is no
renderer support. Can you please tell what is the alternative in log4j2 or
is there any timeline to add renderers in log4j2 ? Can you please give some
information on this?

Thanks and regards,
Pardeep Kumar

Re: Query on renderer support in Log4j2

Posted by Ralph Goers <ra...@dslextreme.com>.
No, Log4j 2 does not support Log4j 1 renderers. To be honest, this is the first email 
received on this list to ever ask about it.

Log4j 1 used renderers because it logged Objects and the only things known about 
an object is that it has class name and a toString method. 

Log4j 2 logs Messages. See http://logging.apache.org/log4j/2.x/manual/messages.html <http://logging.apache.org/log4j/2.x/manual/messages.html>. You 
could get the same effect as the Log4j 1 Renderer by creating a custom MessageFactory 
that looks at the type of objects being passed and chooses the Message implementation to 
use based on that. To be honest though, most people doing more than simple logging use 
a MapMessage for which most of Log4j’s Layouts provide direct support.

Ralph



> On Nov 22, 2021, at 11:02 PM, Pardeep Kumar <pa...@gmail.com> wrote:
> 
> Hi
>      I have upgraded log4j1.x to log4j2.x. In log4j2 currenty there is no
> renderer support. Can you please tell what is the alternative in log4j2 or
> is there any timeline to add renderers in log4j2 ? Can you please give some
> information on this?
> 
> Thanks and regards,
> Pardeep Kumar