Why are you dynamically creating loggers? I know of no valid reason to do that.

Ralph

> On Jun 27, 2019, at 11:38 AM, Gaurav <[email protected]> wrote:
> 
> I am creating millions of loggers. As, the logger is requested at runtime, I 
> cannot store the configuration in the static log4j2.xml. So, I create a 
> rolling file appender and attach it to a logger. 
> 
> On 2019/06/27 13:14:28, Ralph Goers <[email protected]> wrote: 
>> You are creating millions of Loggers or millions of LoggerConfigs? What you 
>> are doing is incomplete. But why would you be dynamically creating millions 
>> of Loggers and Appenders? Whatever you are doing I am sure there is a better 
>> way to do it. Can you please describe your use case and why you think what 
>> you are doing solves it?
>> 
>> Ralph
>> 
>>> On Jun 27, 2019, at 5:28 AM, Gaurav <[email protected]> wrote:
>>> 
>>> Hi all,
>>> 
>>> My application creates millions of loggers and appenders.
>>> 
>>> I'm worried about the memory usage.
>>> 
>>> For that, I am doing following things.
>>> 1.Remove appender from LoggerConfig.
>>> 2.Stop the LoggerConfig.
>>> 3. Remove logger from Configuration.
>>> 
>>> But when I do the performance test, it prints the errors on console that 
>>> "Attempted to append to non-started appender".
>>> 
>>> Do I need to clear them like this? Is there any better way to do it in a 
>>> performance intensive application?
>>> 
>>> Please assist.
>>> 
>> 
>> 
>> 
> 


Reply via email to