Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: Stefan Wendelmann
Added: Aug 21, 2018 9:33 AM
Views: 4
Log4j2 change Config Programmaticly
  1. final LoggerContext ctx = (LoggerContext) org.apache.logging.log4j.LogManager.getContext(false);
  2. final Configuration config = ctx.getConfiguration();
  3. config.getRootLogger().setLevel(Level.ALL);
  4. config.getLoggerContext().getRootLogger().setLevel(Level.ALL);
  5. ctx.updateLoggers();