OOM - with the multiple log files - expecting suggestion to the attached program #2866
Replies: 2 comments
-
Hi Team,
|
Beta Was this translation helpful? Give feedback.
-
Hi @pradnyagandhe, Your code fails to remove unused appenders from the current configuration. Your public void unload(final long i) {
ctx = (LoggerContext) LogManager.getContext(false);
config = ctx.getConfiguration();
// Remove the logger
config.removeLogger("programmaticLogger" + i);
// Remove the appender
((AbstractConfiguration) config).removeAppender("programmaticFileAppender" + i);
ctx.updateLoggers();
} Remark: We don't recommend modifying the current If you are looking for a component that creates appenders dynamically, see |
Beta Was this translation helpful? Give feedback.
-
Hi Log4j2 team,
I have written a sample Java program which creates multiple log files. I am attaching the program. Upon its execution generates a Out Of Memory exception. Please advise.
Multi_LogFile.txt
advise.
The code creates LoggerContext, Configuration, PatternLayout, FileAppender, creating logger, adding appender for every creation of object in a member method and removing appender, stopping appender and removing logger in its another method.
on Execution, get following exception
Thanks,
Pradnya Gandhe
Beta Was this translation helpful? Give feedback.
All reactions