From 944eb42aa36a583fd8eba530981d8132c58c751f Mon Sep 17 00:00:00 2001
From: Technici4n <13494793+Technici4n@users.noreply.github.com>
Date: Wed, 17 Jan 2024 14:04:38 +0100
Subject: [PATCH] Restore log4j configuration override in prod

---
 .../neoforged/fml/loading/targets/CommonLaunchHandler.java   | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/loader/src/main/java/net/neoforged/fml/loading/targets/CommonLaunchHandler.java b/loader/src/main/java/net/neoforged/fml/loading/targets/CommonLaunchHandler.java
index a201e94a0..a6286ded1 100644
--- a/loader/src/main/java/net/neoforged/fml/loading/targets/CommonLaunchHandler.java
+++ b/loader/src/main/java/net/neoforged/fml/loading/targets/CommonLaunchHandler.java
@@ -57,8 +57,9 @@ public void configureTransformationClassLoader(final ITransformingClassLoaderBui
     }
 
     protected String[] preLaunch(String[] arguments, ModuleLayer layer) {
-        // do not overwrite the logging configuration if the user explicitly set another one
-        if (System.getProperty("log4j2.configurationFile") == null) {
+        // In dev, do not overwrite the logging configuration if the user explicitly set another one.
+        // In production, always overwrite the vanilla configuration.
+        if (isProduction() || System.getProperty("log4j2.configurationFile") == null) {
             overwriteLoggingConfiguration(layer);
         }