diff --git a/src/main/java/net/fabricmc/loom/LoomGradleExtension.java b/src/main/java/net/fabricmc/loom/LoomGradleExtension.java index 1e03120..ea089af 100644 --- a/src/main/java/net/fabricmc/loom/LoomGradleExtension.java +++ b/src/main/java/net/fabricmc/loom/LoomGradleExtension.java @@ -66,6 +66,7 @@ public class LoomGradleExtension { public boolean shareCaches = false; private final ConfigurableFileCollection unmappedMods; + private final ConfigurableFileCollection log4jConfigs; final List decompilers = new ArrayList<>(); private final List jarProcessors = new ArrayList<>(); @@ -117,6 +118,7 @@ public class LoomGradleExtension { this.unmappedMods = project.files(); this.runConfigs = project.container(RunConfigSettings.class, baseName -> new RunConfigSettings(project, baseName)); + this.log4jConfigs = project.files(getDefaultLog4jConfigFile()); } /** @@ -348,6 +350,14 @@ public class LoomGradleExtension { return decompilers; } + public File getDefaultLog4jConfigFile() { + return new File(getProjectPersistentCache(), "log4j.xml"); + } + + public ConfigurableFileCollection getLog4jConfigs() { + return log4jConfigs; + } + @ApiStatus.Experimental public void runs(Action> action) { action.execute(runConfigs); diff --git a/src/main/java/net/fabricmc/loom/configuration/providers/LaunchProvider.java b/src/main/java/net/fabricmc/loom/configuration/providers/LaunchProvider.java index c093621..f451116 100644 --- a/src/main/java/net/fabricmc/loom/configuration/providers/LaunchProvider.java +++ b/src/main/java/net/fabricmc/loom/configuration/providers/LaunchProvider.java @@ -59,7 +59,7 @@ public class LaunchProvider extends DependencyProvider { final LaunchConfig launchConfig = new LaunchConfig() .property("fabric.development", "true") .property("fabric.remapClasspathFile", getRemapClasspathFile().getAbsolutePath()) - .property("log4j.configurationFile", getLog4jConfigFile().getAbsolutePath()) + .property("log4j.configurationFile", getAllLog4JConfigFiles()) .property("client", "java.library.path", getExtension().getNativesDirectory().getAbsolutePath()) .property("client", "org.lwjgl.librarypath", getExtension().getNativesDirectory().getAbsolutePath()) @@ -87,7 +87,13 @@ public class LaunchProvider extends DependencyProvider { } private File getLog4jConfigFile() { - return new File(getExtension().getDevLauncherConfig().getParentFile(), "log4j.xml"); + return getExtension().getDefaultLog4jConfigFile(); + } + + private String getAllLog4JConfigFiles() { + return getExtension().getLog4jConfigs().getFiles().stream() + .map(File::getAbsolutePath) + .collect(Collectors.joining(",")); } private File getRemapClasspathFile() {