Re: PatternLayout Vs JsonTemplateLayout/JsonLayout Performance Comparision

Christopher Schultz <[email protected]> Wed, 16 Nov 2022 12:09:01 -0500
Newsgroups gmane.comp.jakarta.log4j.user
Message-ID <[email protected]>
Ganapati,

On 11/16/22 05:54, Ganapathi Vara Prasad wrote:
> Hello Team,
> 
> Our log4j2 configuration uses *PatternLayout* and we are exploring
> switching to JsonLayout for simplifying integration with ELK. I am trying
> to find any performance comparison between pattern and json layouts but
> couldn't find any. I could find only the JsonTemplateLayout benchmark in
> the log4j-perf module.
> 
> I wanted to know:
> 
>     - Is it a reasonable thing to compare the performance of these two
>     layouts?
>     - Are there any existing resources comparing the performance of these
>     two layouts?
>     - What considerations should we make if we switch to JsonTemplateLayout?

Is it even possible to use PatternLayout safely with JSON-encoded data? 
What if you log a username which contains a " character? Won't that 
completely break your JSON?

I think performance shouldn't be your primary consideration, here.

-chris