testpradnya commented on issue #2254:
URL: 
https://github.com/apache/logging-log4j2/issues/2254#issuecomment-1914619723

   Thank you @ppkarwasz for the reply.
   
   
![log4j_setting](https://github.com/apache/logging-log4j2/assets/158046854/d8b596c0-237f-4538-b908-c45ada3a9f48)
   
![log4j_xml](https://github.com/apache/logging-log4j2/assets/158046854/692478f8-188e-448a-9495-0b57a80dee0a)
   Upon getting HTTP request-> we are creating logger using following program->
   So we have too many loggers 
   ```
   
   private void finishAdd(Appender appender, LogConfigItem lci) {
                final LoggerContext ctx = (LoggerContext) 
LogManager.getContext(false);
                final Configuration config = ctx.getConfiguration();
   
                appender.start();
                config.addAppender(appender);
   
                AppenderRef[] refs = new AppenderRef[] { 
AppenderRef.createAppenderRef(appender.getName(), null, null) };
                j++;
                loggerName=loggerName+Integer.toString(j);              
                String strLog = lci.getLogLevel();
                if(strLog == null) //added validation: if the log level is not 
set by the user, set it to Level.INFO.
                        strLog = "Level.INFO";
                Level level = Level.getLevel(strLog);
                LoggerConfig loggerConfig = LoggerConfig.createLogger(false, 
level, loggerName,
                                "false", refs, null, config, null );
                loggerConfig.addAppender(appender, null, null);
                config.addLogger(loggerName, loggerConfig);
                ctx.updateLoggers();
   
                myLogger = LogManager.getLogger(loggerName);
   }
   
   ```
   
   Let me know if you need more information.
   Thanks


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to