code: private static void reloadLog4j2WithXmlConfigFile() {
  		
  		if(!Boolean.parseBoolean(System.getProperty("log.reload","true"))){
  			System.out.println("log.reload:false");
  			return;
  		}
  		String outtype = ResourceUtils.getProperty("log.outtype", "kafka");
  		System.out.println("outtype:"+outtype);
  		if(StringUtils.equalsIgnoreCase("console", outtype))return;
  		
  		try {			
  			// read log4j configuration from xml
  			String log4jConfFileName = "log4j2-"+outtype+".xml";
  			InputStream in = loadFileInputStream(log4jConfFileName);
  			if(in == null){
  				System.err.println("not found log4j configure file["+log4jConfFileName+"] in classpath");
  				return ;
  			}
  			System.out.println("reload log4j from config:"+ log4jConfFileName);
  			XmlConfigurationFactory factory = new XmlConfigurationFactory();
  			
  			
  			// init context
  			LoggerContext logContext = (LoggerContext) LogManager.getContext(true);
  			Configuration configuration = factory.getConfiguration(logContext,new ConfigurationSource(in));
  			logContext.stop();
  			while(logContext.isStopping()){}
  			
  			if(logContext.isStopped()){	 
  				logContext = (LoggerContext) LogManager.getContext(false);
  				logContext.start(configuration);
  				System.out.println("LoggerContext reload...");
  				//logContext.reconfigure();
  				StatusLogger.getLogger().reset();
  			}
  			while(logContext.isStarting()){}
  			if(logContext.isStarted())System.out.println("LoggerContext is started!");
  		} catch (Exception e) {
  			e.printStackTrace();
  		}
  		try {jarFile.close();} catch (Exception e) {}
  	}
docs: 通过xml配置文件重新加载log4j2
  @throws IOException