code: private static void tryForceNotJava1()
  	{
  		String version = System.getProperty("java.version");
  
  		// N.B. Log4j has issues with JVM versions written like "9" and "10"
  		if (version != null && !version.startsWith("1."))
  		{
  			try
  			{
  				Class<Loader> loader = Loader.class;
  
  				for (Field field : loader.getDeclaredFields())
  				{
  					if (field.getName().equals("java1"))
  					{
  						field.setAccessible(true);
  						field.setBoolean(null, false);
  					}
  				}
  			}
  			catch (Throwable t)
  			{
  				// ignore, we must have been denied access. MDC may not work correctly due to log4j 1.2 limitations
  			}
  		}
  	}
docs: HACK to make MDC work with Java 9 onwards<br />