More logging tweaks, including some aimed at userdev.

`forge.logging.markers=<LIST OF MARKERS>` will enable markers.

Signed-off-by: cpw <[email protected]>
This commit is contained in:
cpw committed 2019-01-27 00:06:57 -05:00
1 parent 3c55b46ca0
commit 0a11ffb827
14 files changed
+79 -78

No files matched your search

@@ -34,6 +34,8 @@ import java.util.Map;
import java.util.Objects;
import java.util.function.BiConsumer;
import static net.minecraftforge.fml.Logging.CORE;
public class ForgeI18n {
private static final Logger LOGGER = LogManager.getLogger();
private static Map<String,String> i18n;
@@ -80,7 +82,7 @@ public class ForgeI18n {
}
public static void loadLanguageData(final Map<String, String> properties) {
LOGGER.debug("Loading I18N data entries: {}", properties.size());
LOGGER.debug(CORE,"Loading I18N data entries: {}", properties.size());
i18n = properties;
}
@@ -22,6 +22,7 @@ package net.minecraftforge.fml;
import com.google.common.base.Strings;
import com.google.common.collect.ObjectArrays;
import cpw.mods.modlauncher.Launcher;
import net.minecraftforge.fml.loading.StringUtils;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.core.Filter;
import org.apache.logging.log4j.core.LoggerContext;
@@ -30,27 +31,16 @@ import org.apache.logging.log4j.core.filter.MarkerFilter;
import java.io.File;
import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.Locale;
import java.util.Objects;
public class LaunchTesting
{
public static void main(String... args) throws InterruptedException
{
Configurator.setRootLevel(Level.DEBUG);
// final MarkerFilter classloadingFilter = MarkerFilter.createFilter("CLASSLOADING", Filter.Result.DENY, Filter.Result.NEUTRAL);
// final MarkerFilter launchpluginFilter = MarkerFilter.createFilter("LAUNCHPLUGIN", Filter.Result.DENY, Filter.Result.NEUTRAL);
final MarkerFilter axformFilter= MarkerFilter.createFilter("AXFORM", Filter.Result.DENY, Filter.Result.NEUTRAL);
final MarkerFilter eventbusFilter = MarkerFilter.createFilter("EVENTBUS", Filter.Result.DENY, Filter.Result.NEUTRAL);
final MarkerFilter distxformFilter = MarkerFilter.createFilter("DISTXFORM", Filter.Result.DENY, Filter.Result.NEUTRAL);
// final MarkerFilter scannerFilter = MarkerFilter.createFilter("SCAN", Filter.Result.DENY, Filter.Result.NEUTRAL);
final LoggerContext logcontext = LoggerContext.getContext(false);
// logcontext.getConfiguration().addFilter(classloadingFilter);
// logcontext.getConfiguration().addFilter(launchpluginFilter);
// logcontext.getConfiguration().addFilter(axformFilter);
// logcontext.getConfiguration().addFilter(eventbusFilter);
// logcontext.getConfiguration().addFilter(distxformFilter);
// logcontext.getConfiguration().addFilter(scannerFilter);
logcontext.updateLoggers();
final String markerselection = System.getProperty("forge.logging.markers", "");
Arrays.stream(markerselection.split(",")).forEach(marker-> System.setProperty("forge.logging.marker."+ marker.toLowerCase(Locale.ROOT), "ACCEPT"));
String assets = System.getenv().getOrDefault("assetDirectory", "assets");
String target = System.getenv().get("target");
@@ -50,7 +50,7 @@ public class FMLModContainer extends ModContainer
public FMLModContainer(IModInfo info, String className, ClassLoader modClassLoader, ModFileScanData modFileScanResults)
{
super(info);
LOGGER.debug("Creating FMLModContainer instance for {} with classLoader {} & {}", className, modClassLoader, getClass().getClassLoader());
LOGGER.debug(LOADING,"Creating FMLModContainer instance for {} with classLoader {} & {}", className, modClassLoader, getClass().getClassLoader());
this.scanResults = modFileScanResults;
triggerMap.put(ModLoadingStage.CONSTRUCT, dummy().andThen(this::beforeEvent).andThen(this::constructMod).andThen(this::afterEvent));
triggerMap.put(ModLoadingStage.CREATE_REGISTRIES, dummy().andThen(this::beforeEvent).andThen(this::fireEvent).andThen(this::afterEvent));