Update for log4j2

This commit is contained in:
Christian 2013-12-16 11:47:48 -05:00
parent d188a5ad82
commit a0fcbdccb5
51 changed files with 305 additions and 515 deletions

View file

@ -19,16 +19,24 @@
@SideOnly(Side.CLIENT)
public class Minecraft implements IPlayerUsage
{
@@ -457,6 +462,8 @@
@@ -448,7 +453,7 @@
this.field_110451_am = new SimpleReloadableResourceManager(this.field_110452_an);
this.field_135017_as = new LanguageManager(this.field_110452_an, this.field_71474_y.field_74363_ab);
this.field_110451_am.func_110542_a(this.field_135017_as);
- this.func_110436_a();
+ FMLClientHandler.instance().beginMinecraftLoading(this, this.field_110449_ao, this.field_110451_am);
this.field_71446_o = new TextureManager(this.field_110451_am);
this.field_110451_am.func_110542_a(this.field_71446_o);
this.field_147127_av = new SoundHandler(this.field_110451_am, this.field_71474_y);
@@ -457,6 +462,7 @@
this.func_71357_I();
this.field_71466_p = new FontRenderer(this.field_71474_y, new ResourceLocation("textures/font/ascii.png"), this.field_71446_o, false);
+ FMLClientHandler.instance().beginMinecraftLoading(this, this.field_110449_ao, this.field_110451_am);
+
if (this.field_71474_y.field_74363_ab != null)
{
this.field_71466_p.func_78264_a(this.field_135017_as.func_135042_a() || this.field_71474_y.field_151455_aw);
@@ -508,6 +515,7 @@
@@ -508,6 +514,7 @@
this.field_71446_o.func_130088_a(TextureMap.field_110576_c, new TextureMap(1, "textures/items"));
GL11.glViewport(0, 0, this.field_71443_c, this.field_71440_d);
this.field_71452_i = new EffectRenderer(this.field_71441_e, this.field_71446_o);
@ -36,7 +44,7 @@
this.func_71361_d("Post startup");
this.field_71456_v = new GuiIngame(this);
@@ -527,6 +535,7 @@
@@ -527,6 +534,7 @@
this.func_71352_k();
}
@ -44,7 +52,7 @@
Display.setVSyncEnabled(this.field_71474_y.field_74352_v);
}
@@ -916,9 +925,11 @@
@@ -915,9 +923,11 @@
if (!this.field_71454_w)
{
@ -56,7 +64,7 @@
}
GL11.glFlush();
@@ -1491,11 +1502,15 @@
@@ -1490,11 +1500,15 @@
public void func_71407_l()
{
@ -72,7 +80,7 @@
this.field_71424_I.func_76320_a("gui");
if (!this.field_71445_n)
@@ -1978,6 +1993,8 @@
@@ -1977,6 +1991,8 @@
this.field_71453_ak.func_74428_b();
}

View file

@ -1,15 +1,19 @@
--- ../src-base/minecraft/net/minecraft/entity/EntityList.java
+++ ../src-work/minecraft/net/minecraft/entity/EntityList.java
@@ -5,6 +5,8 @@
@@ -5,6 +5,7 @@
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
+import java.util.logging.Level;
+
import net.minecraft.entity.ai.EntityMinecartMobSpawner;
import net.minecraft.entity.boss.EntityDragon;
import net.minecraft.entity.boss.EntityWither;
@@ -66,6 +68,8 @@
@@ -63,9 +64,13 @@
import net.minecraft.stats.StatBase;
import net.minecraft.stats.StatList;
import net.minecraft.world.World;
+
+import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -18,7 +22,7 @@
public class EntityList
{
private static final Logger field_151516_b = LogManager.getLogger();
@@ -145,9 +149,10 @@
@@ -145,9 +150,10 @@
p_75615_0_.func_82580_o("Type");
}
@ -30,7 +34,7 @@
if (oclass != null)
{
@@ -161,7 +166,17 @@
@@ -161,7 +167,17 @@
if (entity != null)
{
@ -41,7 +45,7 @@
+ }
+ catch (Exception e)
+ {
+ FMLLog.log(Level.SEVERE, e,
+ FMLLog.log(Level.ERROR, e,
+ "An Entity %s(%s) has thrown an exception during loading, its state cannot be restored. Report this to the mod author",
+ p_75615_0_.func_74779_i("id"), oclass.getName());
+ entity = null;

View file

@ -1,6 +1,6 @@
--- ../src-base/minecraft/net/minecraft/tileentity/TileEntity.java
+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntity.java
@@ -1,10 +1,13 @@
@@ -1,10 +1,12 @@
package net.minecraft.tileentity;
+import cpw.mods.fml.common.FMLLog;
@ -9,12 +9,20 @@
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.Callable;
+import java.util.logging.Level;
+
import net.minecraft.block.Block;
import net.minecraft.block.BlockJukebox;
import net.minecraft.crash.CrashReportCategory;
@@ -87,9 +90,10 @@
@@ -12,6 +14,8 @@
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.Packet;
import net.minecraft.world.World;
+
+import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -87,9 +91,10 @@
{
TileEntity tileentity = null;
@ -26,7 +34,7 @@
if (oclass != null)
{
@@ -103,7 +107,17 @@
@@ -103,7 +108,17 @@
if (tileentity != null)
{
@ -36,7 +44,7 @@
+ }
+ catch (Exception ex)
+ {
+ FMLLog.log(Level.SEVERE, ex,
+ FMLLog.log(Level.ERROR, ex,
+ "A TileEntity %s(%s) has thrown an exception during loading, its state cannot be restored. Report this to the mod author",
+ p_145827_0_.func_74779_i("id"), oclass.getName());
+ tileentity = null;
@ -44,7 +52,7 @@
}
else
{
@@ -137,7 +151,6 @@
@@ -137,7 +152,6 @@
}
}

View file

@ -1,15 +1,19 @@
--- ../src-base/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java
+++ ../src-work/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java
@@ -9,6 +9,8 @@
@@ -9,6 +9,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.Set;
+import java.util.logging.Level;
+
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
@@ -27,6 +29,8 @@
@@ -24,9 +25,13 @@
import net.minecraft.world.chunk.NibbleArray;
import net.minecraft.world.storage.IThreadedFileIO;
import net.minecraft.world.storage.ThreadedFileIOBase;
+
+import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -18,7 +22,7 @@
public class AnvilChunkLoader implements IChunkLoader, IThreadedFileIO
{
private static final Logger field_151505_a = LogManager.getLogger();
@@ -260,11 +264,20 @@
@@ -260,11 +265,20 @@
Entity entity = (Entity)iterator.next();
nbttagcompound1 = new NBTTagCompound();
@ -35,14 +39,14 @@
}
+ catch (Exception e)
+ {
+ FMLLog.log(Level.SEVERE, e,
+ FMLLog.log(Level.ERROR, e,
+ "An Entity type %s has thrown an exception trying to write state. It will not persist. Report this to the mod author",
+ entity.getClass().getName());
+ }
}
}
@@ -276,8 +289,16 @@
@@ -276,8 +290,16 @@
{
TileEntity tileentity = (TileEntity)iterator.next();
nbttagcompound1 = new NBTTagCompound();
@ -52,7 +56,7 @@
+ }
+ catch (Exception e)
+ {
+ FMLLog.log(Level.SEVERE, e,
+ FMLLog.log(Level.ERROR, e,
+ "A TileEntity type %s has throw an exception trying to write state. It will not persist. Report this to the mod author",
+ tileentity.getClass().getName());
+ }

View file

@ -17,7 +17,7 @@ import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.logging.Level;
import org.apache.logging.log4j.Level;
import java.util.logging.Logger;
import net.minecraft.client.Minecraft;
@ -176,7 +176,7 @@ public class FMLClientHandler implements IFMLSidedHandler
}
catch (CustomModLoadingErrorDisplayException custom)
{
FMLLog.log(Level.SEVERE, custom, "A custom exception was thrown by a mod, the game will now halt");
FMLLog.log(Level.ERROR, custom, "A custom exception was thrown by a mod, the game will now halt");
customError = custom;
}
catch (LoaderException le)
@ -226,7 +226,7 @@ public class FMLClientHandler implements IFMLSidedHandler
}
catch (CustomModLoadingErrorDisplayException custom)
{
FMLLog.log(Level.SEVERE, custom, "A custom exception was thrown by a mod, the game will now halt");
FMLLog.log(Level.ERROR, custom, "A custom exception was thrown by a mod, the game will now halt");
customError = custom;
return;
}
@ -237,7 +237,7 @@ public class FMLClientHandler implements IFMLSidedHandler
}
// Reload resources
client.func_110436_a();
// client.func_110436_a();
RenderingRegistry.instance().loadEntityRenderers((Map<Class<? extends Entity>, Render>)RenderManager.field_78727_a.field_78729_o);
loading = false;
KeyBindingRegistry.instance().uploadKeyBindingsToGame(client.field_71474_y);
@ -445,12 +445,12 @@ public class FMLClientHandler implements IFMLSidedHandler
}
catch (NoSuchMethodException e)
{
FMLLog.log(Level.SEVERE, "The container %s (type %s) returned an invalid class for it's resource pack.", container.getName(), container.getClass().getName());
FMLLog.log(Level.ERROR, "The container %s (type %s) returned an invalid class for it's resource pack.", container.getName(), container.getClass().getName());
return;
}
catch (Exception e)
{
FMLLog.log(Level.SEVERE, e, "An unexpected exception occurred constructing the custom resource pack for %s", container.getName());
FMLLog.log(Level.ERROR, e, "An unexpected exception occurred constructing the custom resource pack for %s", container.getName());
throw Throwables.propagate(e);
}
}

View file

@ -4,7 +4,7 @@ import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.logging.Level;
import org.apache.logging.log4j.Level;
import javax.imageio.ImageIO;
@ -41,7 +41,7 @@ public class FMLFileResourcePack extends FileResourcePack {
{
if ("pack.mcmeta".equals(resourceName))
{
FMLLog.log(container.getName(), Level.WARNING, "Mod %s is missing a pack.mcmeta file, things may not work well", container.getName());
FMLLog.log(container.getName(), Level.DEBUG, "Mod %s is missing a pack.mcmeta file, substituting a dummy one", container.getName());
return new ByteArrayInputStream(("{\n" +
" \"pack\": {\n"+
" \"description\": \"dummy FML pack for "+container.getName()+"\",\n"+

View file

@ -4,7 +4,7 @@ import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.logging.Level;
import org.apache.logging.log4j.Level;
import javax.imageio.ImageIO;
@ -46,7 +46,7 @@ public class FMLFolderResourcePack extends FolderResourcePack {
{
if ("pack.mcmeta".equals(resourceName))
{
FMLLog.log(container.getName(), Level.WARNING, "Mod %s is missing a pack.mcmeta file, things may not work well", container.getName());
FMLLog.log(container.getName(), Level.DEBUG, "Mod %s is missing a pack.mcmeta file, substituting a dummy one", container.getName());
return new ByteArrayInputStream(("{\n" +
" \"pack\": {\n"+
" \"description\": \"dummy FML pack for "+container.getName()+"\",\n"+

View file

@ -52,6 +52,8 @@ public class GuiModList extends GuiScreen
private ModContainer selectedMod;
private int listWidth;
private ArrayList<ModContainer> mods;
private GuiButton configModButton;
private GuiButton disableModButton;
/**
* @param mainMenu
@ -90,6 +92,10 @@ public class GuiModList extends GuiScreen
}
listWidth=Math.min(listWidth, 150);
this.field_146292_n.add(new GuiButton(6, this.field_146294_l / 2 - 75, this.field_146295_m - 38, I18n.func_135052_a("gui.done")));
configModButton = new GuiButton(7, 10, this.field_146295_m - 58, this.listWidth, 18, "Config");
disableModButton = new GuiButton(8, 10, this.field_146295_m - 36, this.listWidth, 18, "Disable");
this.field_146292_n.add(configModButton);
this.field_146292_n.add(disableModButton);
this.modList=new GuiSlotModList(this, mods, listWidth);
this.modList.registerScrollButtons(this.field_146292_n, 7, 8);
}
@ -123,6 +129,10 @@ public class GuiModList extends GuiScreen
if (selectedMod != null) {
GL11.glEnable(GL11.GL_BLEND);
if (!selectedMod.getMetadata().autogenerated) {
configModButton.field_146125_m = true;
disableModButton.field_146125_m = true;
disableModButton.packedFGColour = 0xFF3377;
configModButton.field_146124_l = false;
int shifty = 35;
String logoFile = selectedMod.getMetadata().logoFile;
if (!logoFile.isEmpty())
@ -199,9 +209,16 @@ public class GuiModList extends GuiScreen
this.func_73732_a(this.field_146289_q, String.format("Mod State: %s",Loader.instance().getModState(selectedMod)), offset, 55, 0xFFFFFF);
this.func_73732_a(this.field_146289_q, "No mod information found", offset, 65, 0xDDDDDD);
this.func_73732_a(this.field_146289_q, "Ask your mod author to provide a mod mcmod.info file", offset, 75, 0xDDDDDD);
configModButton.field_146125_m = false;
disableModButton.field_146125_m = false;
}
GL11.glDisable(GL11.GL_BLEND);
}
else
{
configModButton.field_146125_m = false;
disableModButton.field_146125_m = false;
}
super.func_73863_a(p_571_1_, p_571_2_, p_571_3_);
}

View file

@ -16,8 +16,8 @@ import java.util.EnumSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.Logger;
import net.minecraft.crash.CrashReport;
import net.minecraft.crash.CrashReportCategory;
@ -181,7 +181,7 @@ public class FMLCommonHandler
*/
public void raiseException(Throwable exception, String message, boolean stopGame)
{
FMLLog.log(Level.SEVERE, exception, "Something raised an exception. The message was '%s'. 'stopGame' is %b", message, stopGame);
FMLLog.log(Level.ERROR, exception, "Something raised an exception. The message was '%s'. 'stopGame' is %b", message, stopGame);
if (stopGame)
{
getSidedDelegate().haltGame(message,exception);

View file

@ -17,7 +17,7 @@ import java.security.cert.Certificate;
import java.util.Arrays;
import java.util.Map;
import java.util.Map.Entry;
import java.util.logging.Level;
import org.apache.logging.log4j.Level;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
@ -122,7 +122,7 @@ public class FMLContainer extends DummyModContainer implements WorldAccessContai
ModContainer container = Loader.instance().getIndexedModList().get(modId);
if (container == null)
{
FMLLog.log("fml.ModTracker", Level.SEVERE, "This world was saved with mod %s which appears to be missing, things may not work well", modId);
FMLLog.log("fml.ModTracker", Level.ERROR, "This world was saved with mod %s which appears to be missing, things may not work well", modId);
continue;
}
if (!modVersion.equals(container.getVersion()))

View file

@ -12,17 +12,17 @@
package cpw.mods.fml.common;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.Logger;
@SuppressWarnings("static-access")
public class FMLLog
{
private static cpw.mods.fml.relauncher.FMLRelaunchLog coreLog = cpw.mods.fml.relauncher.FMLRelaunchLog.log;
public static void log(String logChannel, Level level, String format, Object... data)
public static void log(String targetLog, Level level, String format, Object... data)
{
coreLog.log(logChannel, level, format, data);
coreLog.log(targetLog, level, format, data);
}
public static void log(Level level, String format, Object... data)
@ -30,9 +30,9 @@ public class FMLLog
coreLog.log(level, format, data);
}
public static void log(String logChannel, Level level, Throwable ex, String format, Object... data)
public static void log(String targetLog, Level level, Throwable ex, String format, Object... data)
{
coreLog.log(logChannel, level, ex, format, data);
coreLog.log(targetLog, level, ex, format, data);
}
public static void log(Level level, Throwable ex, String format, Object... data)
@ -42,12 +42,12 @@ public class FMLLog
public static void severe(String format, Object... data)
{
log(Level.SEVERE, format, data);
log(Level.ERROR, format, data);
}
public static void warning(String format, Object... data)
{
log(Level.WARNING, format, data);
log(Level.WARN, format, data);
}
public static void info(String format, Object... data)
@ -57,25 +57,16 @@ public class FMLLog
public static void fine(String format, Object... data)
{
log(Level.FINE, format, data);
log(Level.DEBUG, format, data);
}
public static void finer(String format, Object... data)
{
log(Level.FINER, format, data);
log(Level.TRACE, format, data);
}
public static void finest(String format, Object... data)
{
log(Level.FINEST, format, data);
}
public static Logger getLogger()
{
return coreLog.getLogger();
}
public static void makeLog(String logChannel)
{
coreLog.makeLog(logChannel);
}
}

View file

@ -24,7 +24,7 @@ import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.logging.Level;
import org.apache.logging.log4j.Level;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
@ -170,11 +170,11 @@ public class FMLModContainer implements ModContainer
modMetadata.requiredMods = requirements;
modMetadata.dependencies = dependencies;
modMetadata.dependants = dependants;
FMLLog.log(getModId(), Level.FINEST, "Parsed dependency info : %s %s %s", requirements, dependencies, dependants);
FMLLog.log(getModId(), Level.TRACE, "Parsed dependency info : %s %s %s", requirements, dependencies, dependants);
}
else
{
FMLLog.log(getModId(), Level.FINEST, "Using mcmod dependency info : %s %s %s", modMetadata.requiredMods, modMetadata.dependencies, modMetadata.dependants);
FMLLog.log(getModId(), Level.TRACE, "Using mcmod dependency info : %s %s %s", modMetadata.requiredMods, modMetadata.dependencies, modMetadata.dependants);
}
if (Strings.isNullOrEmpty(modMetadata.name))
{
@ -188,18 +188,18 @@ public class FMLModContainer implements ModContainer
if (versionProps != null)
{
internalVersion = versionProps.getProperty(getModId()+".version");
FMLLog.log(getModId(), Level.FINE, "Found version %s for mod %s in version.properties, using", internalVersion, getModId());
FMLLog.log(getModId(), Level.DEBUG, "Found version %s for mod %s in version.properties, using", internalVersion, getModId());
}
}
if (Strings.isNullOrEmpty(internalVersion) && !Strings.isNullOrEmpty(modMetadata.version))
{
FMLLog.log(getModId(), Level.WARNING, "Mod %s is missing the required element 'version' and a version.properties file could not be found. Falling back to metadata version %s", getModId(), modMetadata.version);
FMLLog.log(getModId(), Level.WARN, "Mod %s is missing the required element 'version' and a version.properties file could not be found. Falling back to metadata version %s", getModId(), modMetadata.version);
internalVersion = modMetadata.version;
}
if (Strings.isNullOrEmpty(internalVersion))
{
FMLLog.log(getModId(), Level.WARNING, "Mod %s is missing the required element 'version' and no fallback can be found. Substituting '1.0'.", getModId());
FMLLog.log(getModId(), Level.WARN, "Mod %s is missing the required element 'version' and no fallback can be found. Substituting '1.0'.", getModId());
modMetadata.version = internalVersion = "1.0";
}
@ -218,7 +218,7 @@ public class FMLModContainer implements ModContainer
{
try
{
FMLLog.log(getModId(), Level.FINE,"Attempting to load the file version.properties from %s to locate a version number for %s", getSource().getName(), getModId());
FMLLog.log(getModId(), Level.DEBUG,"Attempting to load the file version.properties from %s to locate a version number for %s", getSource().getName(), getModId());
Properties version = null;
if (getSource().isFile())
{
@ -247,7 +247,7 @@ public class FMLModContainer implements ModContainer
catch (Exception e)
{
Throwables.propagateIfPossible(e);
FMLLog.log(getModId(), Level.FINEST, "Failed to find a usable version.properties file");
FMLLog.log(getModId(), Level.TRACE, "Failed to find a usable version.properties file");
return null;
}
}
@ -299,7 +299,7 @@ public class FMLModContainer implements ModContainer
{
if (this.enabled)
{
FMLLog.log(getModId(), Level.FINE, "Enabling mod %s", getModId());
FMLLog.log(getModId(), Level.DEBUG, "Enabling mod %s", getModId());
this.eventBus = bus;
this.controller = controller;
eventBus.register(this);
@ -328,7 +328,7 @@ public class FMLModContainer implements ModContainer
}
else
{
FMLLog.log(getModId(), Level.SEVERE,"The mod %s appears to have an invalid event annotation %s. This annotation can only apply to methods with recognized event arguments - it will not be called", getModId(), a.annotationType().getSimpleName());
FMLLog.log(getModId(), Level.ERROR,"The mod %s appears to have an invalid event annotation %s. This annotation can only apply to methods with recognized event arguments - it will not be called", getModId(), a.annotationType().getSimpleName());
}
}
else if (a.annotationType().equals(Mod.InstanceFactory.class))
@ -340,11 +340,11 @@ public class FMLModContainer implements ModContainer
}
else if (!(Modifier.isStatic(m.getModifiers()) && m.getParameterTypes().length == 0))
{
FMLLog.log(getModId(), Level.SEVERE, "The InstanceFactory annotation can only apply to a static method, taking zero arguments - it will be ignored on %s(%s)", m.getName(), Arrays.asList(m.getParameterTypes()));
FMLLog.log(getModId(), Level.ERROR, "The InstanceFactory annotation can only apply to a static method, taking zero arguments - it will be ignored on %s(%s)", m.getName(), Arrays.asList(m.getParameterTypes()));
}
else if (factoryMethod != null)
{
FMLLog.log(getModId(), Level.SEVERE, "The InstanceFactory annotation can only be used once, the application to %s(%s) will be ignored", m.getName(), Arrays.asList(m.getParameterTypes()));
FMLLog.log(getModId(), Level.ERROR, "The InstanceFactory annotation can only be used once, the application to %s(%s) will be ignored", m.getName(), Arrays.asList(m.getParameterTypes()));
}
}
}
@ -408,7 +408,7 @@ public class FMLModContainer implements ModContainer
catch (Exception e)
{
Throwables.propagateIfPossible(e);
FMLLog.log(getModId(), Level.WARNING, e, "Attempting to load @%s in class %s for %s and failing", annotationName, targets.getClassName(), mc.getModId());
FMLLog.log(getModId(), Level.WARN, e, "Attempting to load @%s in class %s for %s and failing", annotationName, targets.getClassName(), mc.getModId());
}
}
if (f != null)
@ -419,7 +419,7 @@ public class FMLModContainer implements ModContainer
target = modInstance;
if (!modInstance.getClass().equals(clz))
{
FMLLog.log(getModId(), Level.WARNING, "Unable to inject @%s in non-static field %s.%s for %s as it is NOT the primary mod instance", annotationName, targets.getClassName(), targets.getObjectName(), mc.getModId());
FMLLog.log(getModId(), Level.WARN, "Unable to inject @%s in non-static field %s.%s for %s as it is NOT the primary mod instance", annotationName, targets.getClassName(), targets.getObjectName(), mc.getModId());
continue;
}
}
@ -461,10 +461,10 @@ public class FMLModContainer implements ModContainer
{
if (!sourceFingerprints.contains(expectedFingerprint))
{
Level warnLevel = Level.SEVERE;
Level warnLevel = Level.ERROR;
if (source.isDirectory())
{
warnLevel = Level.FINER;
warnLevel = Level.TRACE;
}
FMLLog.log(getModId(), warnLevel, "The mod %s is expecting signature %s for source %s, however there is no signature matching that description", getModId(), expectedFingerprint, source.getName());
}

View file

@ -3,7 +3,7 @@ package cpw.mods.fml.common;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.logging.Level;
import org.apache.logging.log4j.Level;
import cpw.mods.fml.relauncher.Side;
@ -90,7 +90,7 @@ public interface ILanguageAdapter {
}
catch (InvocationTargetException e)
{
FMLLog.log(Level.SEVERE, e, "An error occured trying to load a proxy into %s.%s", proxyTarget.getSimpleName(), target.getName());
FMLLog.log(Level.ERROR, e, "An error occured trying to load a proxy into %s.%s", proxyTarget.getSimpleName(), target.getName());
throw new LoaderException(e);
}
@ -147,7 +147,7 @@ public interface ILanguageAdapter {
setProxy(target, proxyTarget, proxy);
}
catch (Exception e) {
FMLLog.log(Level.SEVERE, e, "An error occured trying to load a proxy into %s.%s", proxyTarget.getSimpleName(), target.getName());
FMLLog.log(Level.ERROR, e, "An error occured trying to load a proxy into %s.%s", proxyTarget.getSimpleName(), target.getName());
throw new LoaderException(e);
}
}

View file

@ -16,8 +16,8 @@ import java.lang.reflect.InvocationTargetException;
import java.util.Collection;
import java.util.List;
import java.util.Map.Entry;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.logging.log4j.Level;
import com.google.common.base.Joiner;
import com.google.common.collect.ArrayListMultimap;
@ -39,7 +39,6 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLStateEvent;
import cpw.mods.fml.common.functions.ArtifactVersionNameFunction;
import cpw.mods.fml.common.versioning.ArtifactVersion;
import cpw.mods.fml.relauncher.FMLRelaunchLog;
public class LoadController
{
@ -72,18 +71,10 @@ public class LoadController
for (ModContainer mod : loader.getModList())
{
//Create mod logger, and make the EventBus logger a child of it.
FMLRelaunchLog.makeLog(mod.getModId());
Logger modLogger = Logger.getLogger(mod.getModId());
Logger eventLog = Logger.getLogger(EventBus.class.getName() + "." + mod.getModId());
eventLog.setParent(modLogger);
EventBus bus = new EventBus(mod.getModId());
boolean isActive = mod.registerBus(bus, this);
if (isActive)
{
Level level = Logger.getLogger(mod.getModId()).getLevel();
FMLLog.log(mod.getModId(), Level.FINE, "Mod Logging channel %s configured at %s level.", mod.getModId(), level == null ? "default" : level);
FMLLog.log(mod.getModId(), Level.INFO, "Activating mod %s", mod.getModId());
activeModList.add(mod);
modStates.put(mod.getModId(), ModState.UNLOADED);
eventBus.put(mod.getModId(), bus);
@ -91,7 +82,7 @@ public class LoadController
}
else
{
FMLLog.log(mod.getModId(), Level.WARNING, "Mod %s has been disabled through configuration", mod.getModId());
FMLLog.log(mod.getModId(), Level.WARN, "Mod %s has been disabled through configuration", mod.getModId());
modStates.put(mod.getModId(), ModState.UNLOADED);
modStates.put(mod.getModId(), ModState.DISABLED);
}
@ -119,13 +110,13 @@ public class LoadController
FMLLog.severe("Fatal errors were detected during the transition from %s to %s. Loading cannot continue", oldState, desiredState);
StringBuilder sb = new StringBuilder();
printModStates(sb);
FMLLog.getLogger().severe(sb.toString());
FMLLog.severe(sb.toString());
if (errors.size()>0)
{
FMLLog.severe("The following problems were captured during this phase");
for (Entry<String, Throwable> error : errors.entries())
{
FMLLog.log(Level.SEVERE, error.getValue(), "Caught exception from %s", error.getKey());
FMLLog.log(Level.ERROR, error.getValue(), "Caught exception from %s", error.getKey());
if (error.getValue() instanceof IFMLHandledException)
{
toThrow = error.getValue();
@ -186,16 +177,16 @@ public class LoadController
{
if (av.getLabel()!= null && requirements.contains(av.getLabel()) && modStates.containsEntry(av.getLabel(),ModState.ERRORED))
{
FMLLog.log(modId, Level.SEVERE, "Skipping event %s and marking errored mod %s since required dependency %s has errored", stateEvent.getEventType(), modId, av.getLabel());
FMLLog.log(modId, Level.ERROR, "Skipping event %s and marking errored mod %s since required dependency %s has errored", stateEvent.getEventType(), modId, av.getLabel());
modStates.put(modId, ModState.ERRORED);
return;
}
}
activeContainer = mc;
stateEvent.applyModContainer(activeContainer());
FMLLog.log(modId, Level.FINEST, "Sending event %s to mod %s", stateEvent.getEventType(), modId);
FMLLog.log(modId, Level.TRACE, "Sending event %s to mod %s", stateEvent.getEventType(), modId);
eventChannels.get(modId).post(stateEvent);
FMLLog.log(modId, Level.FINEST, "Sent event %s to mod %s", stateEvent.getEventType(), modId);
FMLLog.log(modId, Level.TRACE, "Sent event %s to mod %s", stateEvent.getEventType(), modId);
activeContainer = null;
if (stateEvent instanceof FMLStateEvent)
{
@ -270,7 +261,7 @@ public class LoadController
}
catch (Exception e)
{
FMLLog.log(Level.SEVERE, e, "An unexpected exception");
FMLLog.log(Level.ERROR, e, "An unexpected exception");
throw new LoaderException(e);
}
}

View file

@ -22,7 +22,8 @@ import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.logging.Level;
import org.apache.logging.log4j.Level;
import com.google.common.base.CharMatcher;
import com.google.common.base.Function;
@ -57,7 +58,6 @@ import cpw.mods.fml.common.toposort.ModSortingException.SortingExceptionData;
import cpw.mods.fml.common.toposort.TopologicalSort;
import cpw.mods.fml.common.versioning.ArtifactVersion;
import cpw.mods.fml.common.versioning.VersionParser;
import cpw.mods.fml.relauncher.FMLRelaunchLog;
import cpw.mods.fml.relauncher.Side;
/**
@ -132,7 +132,6 @@ public class Loader
private static File minecraftDir;
private static List<String> injectedContainers;
private File loggingProperties;
private ImmutableMap<String, String> fmlBrandingProperties;
public static Loader instance()
@ -252,7 +251,7 @@ public class Loader
{
FMLLog.severe("%s : before: %s, after: %s", mc.toString(), mc.getDependants(), mc.getDependencies());
}
FMLLog.log(Level.SEVERE, sortException, "The full error");
FMLLog.log(Level.ERROR, sortException, "The full error");
throw sortException;
}
}
@ -304,7 +303,7 @@ public class Loader
}
catch (Exception e)
{
FMLLog.log(Level.SEVERE, e, "A problem occured instantiating the injected mod container %s", cont);
FMLLog.log(Level.ERROR, e, "A problem occured instantiating the injected mod container %s", cont);
throw new LoaderException(e);
}
mods.add(new InjectedModContainer(mc,mc.getSource()));
@ -327,10 +326,6 @@ public class Loader
identifyDuplicates(mods);
namedMods = Maps.uniqueIndex(mods, new ModIdFunction());
FMLLog.info("Forge Mod Loader has identified %d mod%s to load", mods.size(), mods.size() != 1 ? "s" : "");
for (String modId: namedMods.keySet())
{
FMLLog.makeLog(modId);
}
return discoverer;
}
@ -389,7 +384,7 @@ public class Loader
}
catch (IOException ioe)
{
FMLLog.log(Level.SEVERE, ioe, "Failed to resolve loader directories: mods : %s ; config %s", canonicalModsDir.getAbsolutePath(),
FMLLog.log(Level.ERROR, ioe, "Failed to resolve loader directories: mods : %s ; config %s", canonicalModsDir.getAbsolutePath(),
configDir.getAbsolutePath());
throw new LoaderException(ioe);
}
@ -429,11 +424,6 @@ public class Loader
FMLLog.severe("Attempting to load configuration from %s, which is not a directory", canonicalConfigPath);
throw new LoaderException();
}
loggingProperties = new File(canonicalConfigDir, "logging.properties");
FMLLog.info("Reading custom logging properties from %s", loggingProperties.getPath());
FMLRelaunchLog.loadLogConfiguration(loggingProperties);
FMLLog.log(Level.OFF,"Logging level for ForgeModLoader logging is set to %s", FMLRelaunchLog.log.getLogger().getLevel());
}
public List<ModContainer> getModList()
@ -457,9 +447,6 @@ public class Loader
ModDiscoverer disc = identifyMods();
ModAPIManager.INSTANCE.manageAPI(modClassLoader, disc);
disableRequestedMods();
FMLLog.fine("Reloading logging properties from %s", loggingProperties.getPath());
FMLRelaunchLog.loadLogConfiguration(loggingProperties);
FMLLog.fine("Reloaded logging properties");
modController.distributeStateMessage(FMLLoadEvent.class);
sortModList();
ModAPIManager.INSTANCE.cleanupAPIContainers(modController.getActiveModList());
@ -476,7 +463,7 @@ public class Loader
}
catch (MalformedURLException e)
{
FMLLog.log(Level.SEVERE, e, "Encountered a weird problem with non-mod file injection : %s", nonMod.getName());
FMLLog.log(Level.ERROR, e, "Encountered a weird problem with non-mod file injection : %s", nonMod.getName());
}
}
}
@ -655,7 +642,7 @@ public class Loader
if (parseFailure)
{
FMLLog.log(Level.WARNING, "Unable to parse dependency string %s", dependencyString);
FMLLog.log(Level.WARN, "Unable to parse dependency string %s", dependencyString);
throw new LoaderException();
}
}
@ -720,7 +707,7 @@ public class Loader
}
catch (Throwable t)
{
FMLLog.log(Level.SEVERE, t, "A fatal exception occurred during the server starting event");
FMLLog.log(Level.ERROR, t, "A fatal exception occurred during the server starting event");
return false;
}
return true;
@ -789,7 +776,7 @@ public class Loader
}
catch (Throwable t)
{
FMLLog.log(Level.SEVERE, t, "A fatal exception occurred during the server about to start event");
FMLLog.log(Level.ERROR, t, "A fatal exception occurred during the server about to start event");
return false;
}
return true;
@ -843,7 +830,7 @@ public class Loader
{
if (remaps.isEmpty())
{
FMLLog.finest("Skipping remap event - no remaps occured");
FMLLog.finer("Skipping remap event - no remaps occured");
}
else
{

View file

@ -15,7 +15,7 @@ package cpw.mods.fml.common;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Map;
import java.util.logging.Level;
import org.apache.logging.log4j.Level;
import com.google.common.base.Throwables;
import com.google.common.collect.Maps;
@ -66,7 +66,7 @@ public class MetadataCollection
}
catch (JsonParseException e)
{
FMLLog.log(Level.SEVERE, e, "The mcmod.info file in %s cannot be parsed as valid JSON. It will be ignored", sourceName);
FMLLog.log(Level.ERROR, e, "The mcmod.info file in %s cannot be parsed as valid JSON. It will be ignored", sourceName);
return new MetadataCollection();
}
catch (Exception e)

View file

@ -144,6 +144,15 @@ public @interface Mod
@Deprecated
String asmHookClass() default "";
/**
* If your mod doesn't have a runtime persistent effect on the state of the game, and can be disabled without side effects
* (minimap mods, graphical tweak mods) then you can set true here and receive the FMLDeactivationEvent to perform deactivation
* tasks.
* This does not affect administrative disabling through the system property fml.modStates or the config file fmlModState.properties.
*
* @return if I can be deactivated whilst the game is running.
*/
boolean canBeDeactivated() default false;
/**
* A list of custom properties for this mod. Completely up to the mod author if/when they
* want to put anything in here.

View file

@ -181,7 +181,7 @@ public class ModAPIManager {
do
{
APIContainer parent = apiContainers.get(owner.getLabel());
FMLLog.finest("Removing upstream parent %s from %s", parent.ownerMod.getLabel(), container);
FMLLog.finer("Removing upstream parent %s from %s", parent.ownerMod.getLabel(), container);
container.currentReferents.remove(parent.ownerMod.getLabel());
container.referredMods.remove(parent.ownerMod);
owner = parent.ownerMod;

View file

@ -19,7 +19,7 @@ import java.net.URL;
import java.net.URLClassLoader;
import java.util.List;
import java.util.Set;
import java.util.logging.Level;
import org.apache.logging.log4j.Level;
import net.minecraft.launchwrapper.IClassTransformer;
import net.minecraft.launchwrapper.LaunchClassLoader;
@ -71,7 +71,7 @@ public class ModClassLoader extends URLClassLoader
}
catch (URISyntaxException e)
{
FMLLog.log(Level.SEVERE, e, "Unable to process our input to locate the minecraft code");
FMLLog.log(Level.ERROR, e, "Unable to process our input to locate the minecraft code");
throw new LoaderException(e);
}
}

View file

@ -13,7 +13,7 @@
package cpw.mods.fml.common;
import java.util.Arrays;
import java.util.logging.Level;
import org.apache.logging.log4j.Level;
import cpw.mods.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper;
import cpw.mods.fml.relauncher.ReflectionHelper;
@ -36,7 +36,7 @@ public class ObfuscationReflectionHelper
}
catch (UnableToAccessFieldException e)
{
FMLLog.log(Level.SEVERE, e, "There was a problem getting field index %d from %s", fieldIndex, classToAccess.getName());
FMLLog.log(Level.ERROR, e, "There was a problem getting field index %d from %s", fieldIndex, classToAccess.getName());
throw e;
}
}
@ -61,12 +61,12 @@ public class ObfuscationReflectionHelper
}
catch (UnableToFindFieldException e)
{
FMLLog.log(Level.SEVERE,e,"Unable to locate any field %s on type %s", Arrays.toString(fieldNames), classToAccess.getName());
FMLLog.log(Level.ERROR,e,"Unable to locate any field %s on type %s", Arrays.toString(fieldNames), classToAccess.getName());
throw e;
}
catch (UnableToAccessFieldException e)
{
FMLLog.log(Level.SEVERE, e, "Unable to access any field %s on type %s", Arrays.toString(fieldNames), classToAccess.getName());
FMLLog.log(Level.ERROR, e, "Unable to access any field %s on type %s", Arrays.toString(fieldNames), classToAccess.getName());
throw e;
}
}
@ -79,7 +79,7 @@ public class ObfuscationReflectionHelper
}
catch (UnableToAccessFieldException e)
{
FMLLog.log(Level.SEVERE, e, "There was a problem setting field index %d on type %s", fieldIndex, classToAccess.getName());
FMLLog.log(Level.ERROR, e, "There was a problem setting field index %d on type %s", fieldIndex, classToAccess.getName());
throw e;
}
}
@ -92,12 +92,12 @@ public class ObfuscationReflectionHelper
}
catch (UnableToFindFieldException e)
{
FMLLog.log(Level.SEVERE, e, "Unable to locate any field %s on type %s", Arrays.toString(fieldNames), classToAccess.getName());
FMLLog.log(Level.ERROR, e, "Unable to locate any field %s on type %s", Arrays.toString(fieldNames), classToAccess.getName());
throw e;
}
catch (UnableToAccessFieldException e)
{
FMLLog.log(Level.SEVERE, e, "Unable to set any field %s on type %s", Arrays.toString(fieldNames), classToAccess.getName());
FMLLog.log(Level.ERROR, e, "Unable to set any field %s on type %s", Arrays.toString(fieldNames), classToAccess.getName());
throw e;
}
}

View file

@ -15,7 +15,7 @@ package cpw.mods.fml.common;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.Set;
import java.util.logging.Level;
import org.apache.logging.log4j.Level;
import com.google.common.base.Strings;
@ -71,7 +71,7 @@ public class ProxyInjector
}
catch (Exception e)
{
FMLLog.log(Level.SEVERE, e, "An error occured trying to load a proxy into %s.%s", targ.getAnnotationInfo(), targ.getClassName(), targ.getObjectName());
FMLLog.log(Level.ERROR, e, "An error occured trying to load a proxy into %s.%s", targ.getAnnotationInfo(), targ.getClassName(), targ.getObjectName());
throw new LoaderException(e);
}
}

View file

@ -20,7 +20,7 @@ import java.security.cert.Certificate;
import java.util.Map;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.logging.Level;
import org.apache.logging.log4j.Level;
import net.minecraft.launchwrapper.LaunchClassLoader;
@ -123,7 +123,7 @@ public class FMLSanityChecker implements IFMLCallHook
}
catch (Throwable e)
{
FMLRelaunchLog.log(Level.SEVERE, e, "A critical error occurred trying to read the minecraft jar file");
FMLRelaunchLog.log(Level.ERROR, e, "A critical error occurred trying to read the minecraft jar file");
}
finally
{

View file

@ -155,7 +155,7 @@ public class AccessTransformer implements IClassTransformer
return true;
}
});
System.out.printf("Loaded %d rules from AccessTransformer config file %s\n", modifiers.size(), rulesFile);
FMLRelaunchLog.fine("Loaded %d rules from AccessTransformer config file %s\n", modifiers.size(), rulesFile);
}
@Override

View file

@ -39,17 +39,17 @@ public class ModAPITransformer implements IClassTransformer {
ClassReader classReader = new ClassReader(basicClass);
classReader.accept(classNode, 0);
if (logDebugInfo) FMLRelaunchLog.finest("Optional removal - found optionals for class %s - processing", name);
if (logDebugInfo) FMLRelaunchLog.finer("Optional removal - found optionals for class %s - processing", name);
for (ASMData optional : optionals.get(name))
{
String modId = (String) optional.getAnnotationInfo().get("modid");
if (Loader.isModLoaded(modId) || ModAPIManager.INSTANCE.hasAPI(modId))
{
if (logDebugInfo) FMLRelaunchLog.finest("Optional removal skipped - mod present %s", modId);
if (logDebugInfo) FMLRelaunchLog.finer("Optional removal skipped - mod present %s", modId);
continue;
}
if (logDebugInfo) FMLRelaunchLog.finest("Optional on %s triggered - mod missing %s", name, modId);
if (logDebugInfo) FMLRelaunchLog.finer("Optional on %s triggered - mod missing %s", name, modId);
if (optional.getAnnotationInfo().containsKey("iface"))
{
@ -63,7 +63,7 @@ public class ModAPITransformer implements IClassTransformer {
}
}
if (logDebugInfo) FMLRelaunchLog.finest("Optional removal - class %s processed", name);
if (logDebugInfo) FMLRelaunchLog.finer("Optional removal - class %s processed", name);
ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS);
classNode.accept(writer);
@ -78,37 +78,37 @@ public class ModAPITransformer implements IClassTransformer {
if (methodDescriptor.equals(method.name+method.desc))
{
iterator.remove();
if (logDebugInfo) FMLRelaunchLog.finest("Optional removal - method %s removed", methodDescriptor);
if (logDebugInfo) FMLRelaunchLog.finer("Optional removal - method %s removed", methodDescriptor);
return;
}
}
if (logDebugInfo) FMLRelaunchLog.finest("Optional removal - method %s NOT removed - not found", methodDescriptor);
if (logDebugInfo) FMLRelaunchLog.finer("Optional removal - method %s NOT removed - not found", methodDescriptor);
}
private void stripInterface(ClassNode classNode, String interfaceName, boolean stripRefs)
{
String ifaceName = interfaceName.replace('.', '/');
boolean found = classNode.interfaces.remove(ifaceName);
if (found && logDebugInfo) FMLRelaunchLog.finest("Optional removal - interface %s removed", interfaceName);
if (!found && logDebugInfo) FMLRelaunchLog.finest("Optional removal - interface %s NOT removed - not found", interfaceName);
if (found && logDebugInfo) FMLRelaunchLog.finer("Optional removal - interface %s removed", interfaceName);
if (!found && logDebugInfo) FMLRelaunchLog.finer("Optional removal - interface %s NOT removed - not found", interfaceName);
if (found && stripRefs)
{
if (logDebugInfo) FMLRelaunchLog.finest("Optional removal - interface %s - stripping method signature references", interfaceName);
if (logDebugInfo) FMLRelaunchLog.finer("Optional removal - interface %s - stripping method signature references", interfaceName);
for (Iterator<MethodNode> iterator = classNode.methods.iterator(); iterator.hasNext();)
{
MethodNode node = iterator.next();
if (node.desc.contains(ifaceName))
{
if (logDebugInfo) FMLRelaunchLog.finest("Optional removal - interface %s - stripping method containing reference %s", interfaceName, node.name);
if (logDebugInfo) FMLRelaunchLog.finer("Optional removal - interface %s - stripping method containing reference %s", interfaceName, node.name);
iterator.remove();
}
}
if (logDebugInfo) FMLRelaunchLog.finest("Optional removal - interface %s - all method signature references stripped", interfaceName);
if (logDebugInfo) FMLRelaunchLog.finer("Optional removal - interface %s - all method signature references stripped", interfaceName);
}
else if (found)
{
if (logDebugInfo) FMLRelaunchLog.finest("Optional removal - interface %s - NOT stripping method signature references", interfaceName);
if (logDebugInfo) FMLRelaunchLog.finer("Optional removal - interface %s - NOT stripping method signature references", interfaceName);
}
}

View file

@ -21,11 +21,10 @@ import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.minecraft.launchwrapper.LaunchClassLoader;
import org.apache.logging.log4j.Level;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.commons.Remapper;
import org.objectweb.asm.tree.ClassNode;
@ -47,7 +46,6 @@ import com.google.common.collect.Sets;
import com.google.common.io.CharStreams;
import com.google.common.io.InputSupplier;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.patcher.ClassPatchManager;
import cpw.mods.fml.relauncher.FMLRelaunchLog;
@ -112,7 +110,7 @@ public class FMLDeobfuscatingRemapper extends Remapper {
}
catch (IOException ioe)
{
Logger.getLogger("FML").log(Level.SEVERE, "An error occurred loading the deobfuscation map data", ioe);
FMLRelaunchLog.log(Level.ERROR, "An error occurred loading the deobfuscation map data", ioe);
}
methodNameMaps = Maps.newHashMapWithExpectedSize(rawMethodMaps.size());
fieldNameMaps = Maps.newHashMapWithExpectedSize(rawFieldMaps.size());
@ -161,7 +159,7 @@ public class FMLDeobfuscatingRemapper extends Remapper {
}
catch (IOException ioe)
{
FMLRelaunchLog.log(Level.SEVERE, ioe, "An error occurred loading the deobfuscation map data");
FMLRelaunchLog.log(Level.ERROR, ioe, "An error occurred loading the deobfuscation map data");
}
methodNameMaps = Maps.newHashMapWithExpectedSize(rawMethodMaps.size());
fieldNameMaps = Maps.newHashMapWithExpectedSize(rawFieldMaps.size());
@ -226,7 +224,7 @@ public class FMLDeobfuscatingRemapper extends Remapper {
}
catch (IOException e)
{
FMLLog.log(Level.SEVERE,e, "A critical exception occured reading a class file %s", owner);
FMLRelaunchLog.log(Level.ERROR,e, "A critical exception occured reading a class file %s", owner);
}
return null;
}
@ -337,7 +335,7 @@ public class FMLDeobfuscatingRemapper extends Remapper {
if (DUMP_FIELD_MAPS)
{
FMLRelaunchLog.finest("Field map for %s : %s", className, fieldNameMaps.get(className));
FMLRelaunchLog.finer("Field map for %s : %s", className, fieldNameMaps.get(className));
}
}
return fieldNameMaps.get(className);
@ -354,7 +352,7 @@ public class FMLDeobfuscatingRemapper extends Remapper {
}
if (DUMP_METHOD_MAPS)
{
FMLRelaunchLog.finest("Method map for %s : %s", className, methodNameMaps.get(className));
FMLRelaunchLog.finer("Method map for %s : %s", className, methodNameMaps.get(className));
}
}

View file

@ -17,9 +17,10 @@ import java.io.FileFilter;
import java.io.FileInputStream;
import java.util.Arrays;
import java.util.List;
import java.util.logging.Level;
import java.util.regex.Matcher;
import org.apache.logging.log4j.Level;
import com.google.common.base.Throwables;
import com.google.common.collect.Lists;
@ -84,7 +85,7 @@ public class DirectoryDiscoverer implements ITypeDiscoverer
{
if (file.isDirectory())
{
FMLLog.finest("Recursing into package %s", path + file.getName());
FMLLog.finer("Recursing into package %s", path + file.getName());
exploreFileSystem(path + file.getName() + ".", file, harvestedMods, candidate, mc);
continue;
}
@ -102,7 +103,7 @@ public class DirectoryDiscoverer implements ITypeDiscoverer
}
catch (LoaderException e)
{
FMLLog.log(Level.SEVERE, e, "There was a problem reading the file %s - probably this is a corrupt file", file.getPath());
FMLLog.log(Level.ERROR, e, "There was a problem reading the file %s - probably this is a corrupt file", file.getPath());
throw e;
}
catch (Exception e)

View file

@ -15,7 +15,7 @@ package cpw.mods.fml.common.discovery;
import java.util.Collections;
import java.util.List;
import java.util.jar.JarFile;
import java.util.logging.Level;
import org.apache.logging.log4j.Level;
import java.util.regex.Matcher;
import java.util.zip.ZipEntry;
@ -42,7 +42,7 @@ public class JarDiscoverer implements ITypeDiscoverer
if (jar.getManifest()!=null && (jar.getManifest().getMainAttributes().get("FMLCorePlugin") != null || jar.getManifest().getMainAttributes().get("TweakClass") != null))
{
FMLLog.finest("Ignoring coremod or tweak system %s", candidate.getModContainer());
FMLLog.finer("Ignoring coremod or tweak system %s", candidate.getModContainer());
return foundMods;
}
ZipEntry modInfo = jar.getEntry("mcmod.info");
@ -74,7 +74,7 @@ public class JarDiscoverer implements ITypeDiscoverer
}
catch (LoaderException e)
{
FMLLog.log(Level.SEVERE, e, "There was a problem reading the entry %s in the jar %s - probably a corrupt zip", ze.getName(), candidate.getModContainer().getPath());
FMLLog.log(Level.ERROR, e, "There was a problem reading the entry %s in the jar %s - probably a corrupt zip", ze.getName(), candidate.getModContainer().getPath());
jar.close();
throw e;
}
@ -92,7 +92,7 @@ public class JarDiscoverer implements ITypeDiscoverer
}
catch (Exception e)
{
FMLLog.log(Level.WARNING, e, "Zip file %s failed to read properly, it will be ignored", candidate.getModContainer().getName());
FMLLog.log(Level.WARN, e, "Zip file %s failed to read properly, it will be ignored", candidate.getModContainer().getName());
}
finally
{

View file

@ -16,7 +16,7 @@ import java.io.File;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.logging.Level;
import org.apache.logging.log4j.Level;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -143,7 +143,7 @@ public class ModDiscoverer
}
catch (LoaderException le)
{
FMLLog.log(Level.WARNING, le, "Identified a problem with the mod candidate %s, ignoring this source", candidate.getModContainer());
FMLLog.log(Level.WARN, le, "Identified a problem with the mod candidate %s, ignoring this source", candidate.getModContainer());
}
catch (Throwable t)
{

View file

@ -17,8 +17,8 @@ import java.io.InputStream;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.logging.Level;
import org.apache.logging.log4j.Level;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.Type;
@ -54,7 +54,7 @@ public class ASMModParser
}
catch (Exception ex)
{
FMLLog.log(Level.SEVERE, ex, "Unable to read a class file correctly");
FMLLog.log(Level.ERROR, ex, "Unable to read a class file correctly");
throw new LoaderException(ex);
}
}

View file

@ -51,7 +51,7 @@ public class FMLInterModComms {
{
this.activeContainer = activeContainer;
this.currentList = null;
FMLLog.finest("Attempting to deliver %d IMC messages to mod %s", modMessages.get(activeContainer.getModId()).size(), activeContainer.getModId());
FMLLog.finer("Attempting to deliver %d IMC messages to mod %s", modMessages.get(activeContainer.getModId()).size(), activeContainer.getModId());
}
private ImmutableList<IMCMessage> currentList;

View file

@ -5,7 +5,7 @@
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
*
* Contributors:
* cpw - implementation
*/
@ -16,9 +16,10 @@ import java.io.File;
import java.security.CodeSource;
import java.security.cert.Certificate;
import java.util.Properties;
import java.util.logging.Logger;
import cpw.mods.fml.common.FMLLog;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import cpw.mods.fml.common.LoaderState.ModState;
import cpw.mods.fml.common.FMLModContainer;
import cpw.mods.fml.common.ModContainer;
@ -100,8 +101,7 @@ public class FMLPreInitializationEvent extends FMLStateEvent
*/
public Logger getModLog()
{
Logger log = Logger.getLogger(modContainer.getModId());
log.setParent(FMLLog.getLogger());
Logger log = LogManager.getLogger(modContainer.getModId());
return log;
}

View file

@ -4,6 +4,7 @@ import java.io.File;
import java.lang.reflect.Method;
import java.util.List;
import cpw.mods.fml.relauncher.CoreModManager;
import cpw.mods.fml.relauncher.FMLInjectionData;
import cpw.mods.fml.relauncher.FMLRelaunchLog;
@ -25,7 +26,11 @@ public class FMLDeobfTweaker implements ITweaker {
{
classLoader.registerTransformer("cpw.mods.fml.common.asm.transformers.DeobfuscationTransformer");
}
classLoader.registerTransformer("cpw.mods.fml.common.asm.transformers.AccessTransformer");
// Add all the access transformers now as well
for (String transformer : CoreModManager.getAccessTransformers())
{
classLoader.registerTransformer(transformer);
}
try
{
FMLRelaunchLog.fine("Validating minecraft");

View file

@ -6,13 +6,14 @@ import java.net.URISyntaxException;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.minecraft.launchwrapper.ITweaker;
import net.minecraft.launchwrapper.Launch;
import net.minecraft.launchwrapper.LaunchClassLoader;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import com.google.common.base.Throwables;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
@ -102,7 +103,7 @@ public class FMLTweaker implements ITweaker {
}
catch (URISyntaxException e)
{
Logger.getLogger("FMLTWEAK").log(Level.SEVERE, "Missing URI information for FML tweak");
LogManager.getLogger("FMLTWEAK").log(Level.ERROR, "Missing URI information for FML tweak");
throw Throwables.propagate(e);
}
}
@ -110,6 +111,7 @@ public class FMLTweaker implements ITweaker {
@Override
public void injectIntoClassLoader(LaunchClassLoader classLoader)
{
classLoader.addClassLoaderExclusion("org.apache.");
classLoader.addTransformerExclusion("cpw.mods.fml.repackage.");
classLoader.addTransformerExclusion("cpw.mods.fml.relauncher.");
classLoader.addTransformerExclusion("cpw.mods.fml.common.asm.transformers.");

View file

@ -21,7 +21,7 @@ import io.netty.util.AttributeKey;
import java.util.EnumMap;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
import org.apache.logging.log4j.Level;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
@ -371,7 +371,7 @@ public enum NetworkRegistry
ModContainer mc = FMLCommonHandler.instance().findContainerFor(mod);
if (mc == null)
{
FMLLog.log(Level.SEVERE, "Mod of type %s attempted to register a gui network handler during a construction phase", mod.getClass().getName());
FMLLog.log(Level.ERROR, "Mod of type %s attempted to register a gui network handler during a construction phase", mod.getClass().getName());
throw new RuntimeException("Invalid attempt to create a GUI during mod construction. Use an EventHandler instead");
}
serverGuiHandlers.put(mc, handler);

View file

@ -4,7 +4,7 @@ import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import java.util.List;
import java.util.logging.Level;
import org.apache.logging.log4j.Level;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.client.multiplayer.WorldClient;
@ -119,7 +119,7 @@ public class EntitySpawnHandler extends SimpleChannelInboundHandler<FMLMessage.E
System.out.println("Entity spawned on client");
} catch (Exception e)
{
FMLLog.log(Level.SEVERE, e, "A severe problem occurred during the spawning of an entity");
FMLLog.log(Level.ERROR, e, "A severe problem occurred during the spawning of an entity");
throw Throwables.propagate(e);
}
}

View file

@ -15,7 +15,7 @@ package cpw.mods.fml.common.network.internal;
import java.lang.reflect.Method;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
import org.apache.logging.log4j.Level;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableSet;
@ -62,7 +62,7 @@ public class NetworkModHolder
}
catch (Exception e)
{
FMLLog.log(Level.SEVERE, e, "Error occurred invoking NetworkCheckHandler %s at %s", checkHandler.getName(), container);
FMLLog.log(Level.ERROR, e, "Error occurred invoking NetworkCheckHandler %s at %s", checkHandler.getName(), container);
return false;
}
}
@ -138,7 +138,7 @@ public class NetworkModHolder
}
catch (Exception e)
{
FMLLog.log(Level.WARNING, e, "The declared version check handler method %s on network mod id %s is not accessible", networkCheckHandlerMethod, container.getModId());
FMLLog.log(Level.WARN, e, "The declared version check handler method %s on network mod id %s is not accessible", networkCheckHandlerMethod, container.getModId());
}
}
if (this.checkHandler != null)
@ -152,13 +152,13 @@ public class NetworkModHolder
}
catch (InvalidVersionSpecificationException e)
{
FMLLog.log(Level.WARNING, e, "Invalid bounded range %s specified for network mod id %s", acceptableVersionRange, container.getModId());
FMLLog.log(Level.WARN, e, "Invalid bounded range %s specified for network mod id %s", acceptableVersionRange, container.getModId());
}
this.checker = new DefaultNetworkChecker();
} else {
this.checker = new IgnoredChecker();
}
FMLLog.finest("Testing mod %s to verify it accepts its own version in a remote connection", container.getModId());
FMLLog.finer("Testing mod %s to verify it accepts its own version in a remote connection", container.getModId());
boolean acceptsSelf = acceptVersion(container.getVersion());
if (!acceptsSelf)
{
@ -166,7 +166,7 @@ public class NetworkModHolder
}
else
{
FMLLog.finest("The mod %s accepts its own version (%s)", container.getModId(), container.getVersion());
FMLLog.finer("The mod %s accepts its own version (%s)", container.getModId(), container.getVersion());
}
}

View file

@ -12,9 +12,10 @@ import java.util.jar.JarEntry;
import java.util.jar.JarInputStream;
import java.util.jar.JarOutputStream;
import java.util.jar.Pack200;
import java.util.logging.Level;
import java.util.regex.Pattern;
import org.apache.logging.log4j.Level;
import net.minecraft.launchwrapper.LaunchClassLoader;
import LZMA.LzmaInputStream;
@ -116,7 +117,7 @@ public class ClassPatchManager {
}
catch (IOException e)
{
FMLRelaunchLog.log(Level.SEVERE, e, "Encountered problem runtime patching class %s", name);
FMLRelaunchLog.log(Level.ERROR, e, "Encountered problem runtime patching class %s", name);
continue;
}
}
@ -133,7 +134,7 @@ public class ClassPatchManager {
}
catch (IOException e)
{
FMLRelaunchLog.log(Level.SEVERE, e, "Failed to write %s to %s", mappedName, tempDir.getAbsolutePath());
FMLRelaunchLog.log(Level.ERROR, e, "Failed to write %s to %s", mappedName, tempDir.getAbsolutePath());
}
}
patchedClasses.put(name,inputData);
@ -149,7 +150,7 @@ public class ClassPatchManager {
InputStream binpatchesCompressed = getClass().getResourceAsStream("/binpatches.pack.lzma");
if (binpatchesCompressed==null)
{
FMLRelaunchLog.log(Level.SEVERE, "The binary patch set is missing. Either you are in a development environment, or things are not going to work!");
FMLRelaunchLog.log(Level.ERROR, "The binary patch set is missing. Either you are in a development environment, or things are not going to work!");
return;
}
LzmaInputStream binpatchesDecompressed = new LzmaInputStream(binpatchesCompressed);
@ -160,7 +161,7 @@ public class ClassPatchManager {
}
catch (Exception e)
{
FMLRelaunchLog.log(Level.SEVERE, e, "Error occurred reading binary patches. Expect severe problems!");
FMLRelaunchLog.log(Level.ERROR, e, "Error occurred reading binary patches. Expect severe problems!");
throw Throwables.propagate(e);
}
@ -199,7 +200,7 @@ public class ClassPatchManager {
private ClassPatch readPatch(JarEntry patchEntry, JarInputStream jis)
{
FMLRelaunchLog.finest("Reading patch data from %s", patchEntry.getName());
FMLRelaunchLog.finer("Reading patch data from %s", patchEntry.getName());
ByteArrayDataInput input;
try
{
@ -207,7 +208,7 @@ public class ClassPatchManager {
}
catch (IOException e)
{
FMLRelaunchLog.log(Level.WARNING, e, "Unable to read binpatch file %s - ignoring", patchEntry.getName());
FMLRelaunchLog.log(Level.WARN, e, "Unable to read binpatch file %s - ignoring", patchEntry.getName());
return null;
}
String name = input.readUTF();

View file

@ -7,7 +7,9 @@ import java.util.List;
import java.util.Locale;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.logging.Level;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import java.util.logging.Logger;
import com.google.common.hash.Hashing;
@ -30,7 +32,7 @@ public class GenDiffSet {
String outputDir = args[3]; //Path to place generated .binpatch
String killTarget = args[4]; //"true" if we should destroy the target file if it generated a successful .binpatch
Logger.getLogger("GENDIFF").log(Level.INFO, String.format("Creating patches at %s for %s from %s", outputDir, sourceJar, targetDir));
LogManager.getLogger("GENDIFF").log(Level.INFO, String.format("Creating patches at %s for %s from %s", outputDir, sourceJar, targetDir));
Delta delta = new Delta();
FMLDeobfuscatingRemapper remapper = FMLDeobfuscatingRemapper.INSTANCE;
remapper.setupLoadOnly(deobfData, false);

View file

@ -16,7 +16,8 @@ import java.util.BitSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import org.apache.logging.log4j.Level;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
@ -162,7 +163,7 @@ public class EntityRegistry
String entityModName = String.format("%s.%s", mc.getModId(), entityName);
EntityList.field_75626_c.put(entityClass, entityModName);
EntityList.field_75625_b.put(entityModName, entityClass);
FMLLog.finest("Automatically registered mod %s entity %s as %s", mc.getModId(), entityName, entityModName);
FMLLog.finer("Automatically registered mod %s entity %s as %s", mc.getModId(), entityName, entityModName);
}
else
{
@ -171,7 +172,7 @@ public class EntityRegistry
}
catch (IllegalArgumentException e)
{
FMLLog.log(Level.WARNING, e, "The mod %s tried to register the entity (name,class) (%s,%s) one or both of which are already registered", mc.getModId(), entityName, entityClass.getName());
FMLLog.log(Level.WARN, e, "The mod %s tried to register the entity (name,class) (%s,%s) one or both of which are already registered", mc.getModId(), entityName, entityClass.getName());
return;
}
entityRegistrations.put(mc, er);
@ -218,7 +219,7 @@ public class EntityRegistry
}
catch (IllegalArgumentException e)
{
FMLLog.log(Level.SEVERE, "The entity ID %d for mod %s is not an unsigned byte and may not work", id, Loader.instance().activeModContainer().getModId());
FMLLog.log(Level.ERROR, "The entity ID %d for mod %s is not an unsigned byte and may not work", id, Loader.instance().activeModContainer().getModId());
}
if (!availableIndicies.get(realId))

View file

@ -16,7 +16,7 @@ import java.io.File;
import java.io.IOException;
import java.util.Map;
import java.util.Map.Entry;
import java.util.logging.Level;
import org.apache.logging.log4j.Level;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
@ -111,7 +111,7 @@ public class GameData {
}
catch (IOException e)
{
FMLLog.log(Level.SEVERE, e, "Failed to write registry data to %s", f.getAbsolutePath());
FMLLog.log(Level.ERROR, e, "Failed to write registry data to %s", f.getAbsolutePath());
}
}
}

View file

@ -17,7 +17,7 @@ import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import java.util.logging.Level;
import org.apache.logging.log4j.Level;
import net.minecraft.block.Block;
import net.minecraft.entity.item.EntityItem;
@ -166,7 +166,7 @@ public class GameRegistry
}
catch (Exception e)
{
FMLLog.log(Level.SEVERE, e, "Caught an exception during block registration");
FMLLog.log(Level.ERROR, e, "Caught an exception during block registration");
throw new LoaderException(e);
}
}

View file

@ -19,7 +19,7 @@ import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import java.util.logging.Level;
import org.apache.logging.log4j.Level;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
@ -146,11 +146,11 @@ public class LanguageRegistry
ModContainer activeModContainer = Loader.instance().activeModContainer();
if (activeModContainer!=null)
{
FMLLog.log(activeModContainer.getModId(), Level.SEVERE, "The language resource %s cannot be located on the classpath. This is a programming error.", localizationFile);
FMLLog.log(activeModContainer.getModId(), Level.ERROR, "The language resource %s cannot be located on the classpath. This is a programming error.", localizationFile);
}
else
{
FMLLog.log(Level.SEVERE, "The language resource %s cannot be located on the classpath. This is a programming error.", localizationFile);
FMLLog.log(Level.ERROR, "The language resource %s cannot be located on the classpath. This is a programming error.", localizationFile);
}
}
}
@ -173,7 +173,7 @@ public class LanguageRegistry
addStringLocalization(langPack, lang);
}
catch (IOException e) {
FMLLog.log(Level.SEVERE, e, "Unable to load localization from file %s", localizationFile);
FMLLog.log(Level.ERROR, e, "Unable to load localization from file %s", localizationFile);
}
finally {
try {

View file

@ -13,7 +13,7 @@
package cpw.mods.fml.common.versioning;
import java.util.List;
import java.util.logging.Level;
import org.apache.logging.log4j.Level;
import com.google.common.base.Splitter;
import com.google.common.base.Strings;
@ -68,7 +68,7 @@ public class VersionParser
}
catch (InvalidVersionSpecificationException e)
{
FMLLog.log(Level.SEVERE, e, "Unable to parse a version range specification successfully %s", range);
FMLLog.log(Level.ERROR, e, "Unable to parse a version range specification successfully %s", range);
throw new LoaderException(e);
}
}

View file

@ -28,7 +28,8 @@ import java.util.List;
import java.util.Map;
import java.util.jar.Attributes;
import java.util.jar.JarFile;
import java.util.logging.Level;
import org.apache.logging.log4j.Level;
import net.minecraft.launchwrapper.ITweaker;
import net.minecraft.launchwrapper.Launch;
@ -60,6 +61,7 @@ public class CoreModManager {
private static FMLTweaker tweaker;
private static File mcDir;
private static List<String> reparsedCoremods = Lists.newArrayList();
private static List<String> accessTransformers = Lists.newArrayList();
private static class FMLPluginWrapper implements ITweaker {
public final String name;
@ -96,7 +98,7 @@ public class CoreModManager {
FMLRelaunchLog.fine("Injecting coremod %s {%s} class transformers", name, coreModInstance.getClass().getName());
if (coreModInstance.getASMTransformerClass() != null) for (String transformer : coreModInstance.getASMTransformerClass())
{
FMLRelaunchLog.finest("Registering transformer %s", transformer);
FMLRelaunchLog.finer("Registering transformer %s", transformer);
classLoader.registerTransformer(transformer);
}
FMLRelaunchLog.fine("Injection complete");
@ -181,7 +183,7 @@ public class CoreModManager {
}
catch (Exception e)
{
FMLRelaunchLog.log(Level.SEVERE, e, "The patch transformer failed to load! This is critical, loading cannot continue!");
FMLRelaunchLog.log(Level.ERROR, e, "The patch transformer failed to load! This is critical, loading cannot continue!");
throw Throwables.propagate(e);
}
@ -251,7 +253,7 @@ public class CoreModManager {
}
catch (IOException ioe)
{
FMLRelaunchLog.log(Level.SEVERE, ioe, "Unable to read the jar file %s - ignoring", coreMod.getName());
FMLRelaunchLog.log(Level.ERROR, ioe, "Unable to read the jar file %s - ignoring", coreMod.getName());
continue;
}
finally
@ -292,19 +294,19 @@ public class CoreModManager {
classLoader.addURL(coreMod.toURI().toURL());
if (!mfAttributes.containsKey(COREMODCONTAINSFMLMOD))
{
FMLRelaunchLog.finest("Adding %s to the list of known coremods, it will not be examined again", coreMod.getName());
FMLRelaunchLog.finer("Adding %s to the list of known coremods, it will not be examined again", coreMod.getName());
loadedCoremods.add(coreMod.getName());
}
else
{
FMLRelaunchLog.finest("Found FMLCorePluginContainsFMLMod marker in %s, it will be examined later for regular @Mod instances",
FMLRelaunchLog.finer("Found FMLCorePluginContainsFMLMod marker in %s, it will be examined later for regular @Mod instances",
coreMod.getName());
reparsedCoremods.add(coreMod.getName());
}
}
catch (MalformedURLException e)
{
FMLRelaunchLog.log(Level.SEVERE, e, "Unable to convert file into a URL. weird");
FMLRelaunchLog.log(Level.ERROR, e, "Unable to convert file into a URL. weird");
continue;
}
loadCoreMod(classLoader, fmlCorePlugin, coreMod);
@ -383,23 +385,23 @@ public class CoreModManager {
if (coreModNameAnn != null && !Strings.isNullOrEmpty(coreModNameAnn.value()))
{
coreModName = coreModNameAnn.value();
FMLRelaunchLog.finest("coremod named %s is loading", coreModName);
FMLRelaunchLog.finer("coremod named %s is loading", coreModName);
}
MCVersion requiredMCVersion = coreModClazz.getAnnotation(IFMLLoadingPlugin.MCVersion.class);
if (!Arrays.asList(rootPlugins).contains(coreModClass) && (requiredMCVersion == null || Strings.isNullOrEmpty(requiredMCVersion.value())))
{
FMLRelaunchLog.log(Level.WARNING, "The coremod %s does not have a MCVersion annotation, it may cause issues with this version of Minecraft",
FMLRelaunchLog.log(Level.WARN, "The coremod %s does not have a MCVersion annotation, it may cause issues with this version of Minecraft",
coreModClass);
}
else if (requiredMCVersion != null && !FMLInjectionData.mccversion.equals(requiredMCVersion.value()))
{
FMLRelaunchLog.log(Level.SEVERE, "The coremod %s is requesting minecraft version %s and minecraft is %s. It will be ignored.", coreModClass,
FMLRelaunchLog.log(Level.ERROR, "The coremod %s is requesting minecraft version %s and minecraft is %s. It will be ignored.", coreModClass,
requiredMCVersion.value(), FMLInjectionData.mccversion);
return null;
}
else if (requiredMCVersion != null)
{
FMLRelaunchLog.log(Level.FINE, "The coremod %s requested minecraft version %s and minecraft is %s. It will be loaded.", coreModClass,
FMLRelaunchLog.log(Level.DEBUG, "The coremod %s requested minecraft version %s and minecraft is %s. It will be loaded.", coreModClass,
requiredMCVersion.value(), FMLInjectionData.mccversion);
}
TransformerExclusions trExclusions = coreModClazz.getAnnotation(IFMLLoadingPlugin.TransformerExclusions.class);
@ -420,6 +422,12 @@ public class CoreModManager {
int sortIndex = index != null ? index.value() : 0;
IFMLLoadingPlugin plugin = (IFMLLoadingPlugin) coreModClazz.newInstance();
String accessTransformerClass = plugin.getAccessTransformerClass();
if (accessTransformerClass != null)
{
FMLRelaunchLog.log(Level.DEBUG, "Added access transformer class %s to enqueued access transformers", accessTransformerClass);
accessTransformers.add(accessTransformerClass);
}
FMLPluginWrapper wrap = new FMLPluginWrapper(coreModName, plugin, location, sortIndex, dependencies);
loadPlugins.add(wrap);
FMLRelaunchLog.fine("Enqueued coremod %s", coreModName);
@ -428,21 +436,21 @@ public class CoreModManager {
catch (ClassNotFoundException cnfe)
{
if (!Lists.newArrayList(rootPlugins).contains(coreModClass))
FMLRelaunchLog.log(Level.SEVERE, cnfe, "Coremod %s: Unable to class load the plugin %s", coreModName, coreModClass);
FMLRelaunchLog.log(Level.ERROR, cnfe, "Coremod %s: Unable to class load the plugin %s", coreModName, coreModClass);
else
FMLRelaunchLog.fine("Skipping root plugin %s", coreModClass);
}
catch (ClassCastException cce)
{
FMLRelaunchLog.log(Level.SEVERE, cce, "Coremod %s: The plugin %s is not an implementor of IFMLLoadingPlugin", coreModName, coreModClass);
FMLRelaunchLog.log(Level.ERROR, cce, "Coremod %s: The plugin %s is not an implementor of IFMLLoadingPlugin", coreModName, coreModClass);
}
catch (InstantiationException ie)
{
FMLRelaunchLog.log(Level.SEVERE, ie, "Coremod %s: The plugin class %s was not instantiable", coreModName, coreModClass);
FMLRelaunchLog.log(Level.ERROR, ie, "Coremod %s: The plugin class %s was not instantiable", coreModName, coreModClass);
}
catch (IllegalAccessException iae)
{
FMLRelaunchLog.log(Level.SEVERE, iae, "Coremod %s: The plugin class %s was not accessible", coreModName, coreModClass);
FMLRelaunchLog.log(Level.ERROR, iae, "Coremod %s: The plugin class %s was not accessible", coreModName, coreModClass);
}
return null;
}
@ -464,7 +472,7 @@ public class CoreModManager {
{
if (!pluginMap.containsKey(dep))
{
FMLRelaunchLog.log(Level.SEVERE, "Missing coremod dependency - the coremod %s depends on coremod %s which isn't present.", plug.name, dep);
FMLRelaunchLog.log(Level.ERROR, "Missing coremod dependency - the coremod %s depends on coremod %s which isn't present.", plug.name, dep);
throw new RuntimeException();
}
sortGraph.addEdge(plug, pluginMap.get(dep));
@ -477,7 +485,7 @@ public class CoreModManager {
}
catch (Exception e)
{
FMLLog.log(Level.SEVERE, e, "There was a problem performing the coremod sort");
FMLLog.log(Level.ERROR, e, "There was a problem performing the coremod sort");
throw Throwables.propagate(e);
}
}
@ -552,4 +560,9 @@ public class CoreModManager {
}
});
}
public static List<String> getAccessTransformers()
{
return accessTransformers;
}
}

View file

@ -22,9 +22,15 @@ public class FMLCorePlugin implements IFMLLoadingPlugin
return new String[] {
"cpw.mods.fml.common.asm.transformers.MarkerTransformer",
"cpw.mods.fml.common.asm.transformers.SideTransformer",
"cpw.mods.fml.common.asm.transformers.EventSubscriptionTransformer",
};
}
@Override
public String getAccessTransformerClass()
{
return "cpw.mods.fml.common.asm.transformers.AccessTransformer";
}
@Override
public String getModContainerClass()
{

View file

@ -18,7 +18,7 @@ import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import java.util.logging.Level;
import org.apache.logging.log4j.Level;
import net.minecraft.launchwrapper.LaunchClassLoader;
@ -49,7 +49,7 @@ public class FMLInjectionData
}
catch (IOException ex)
{
FMLRelaunchLog.log(Level.SEVERE, ex, "Could not get FML version information - corrupted installation detected!");
FMLRelaunchLog.log(Level.ERROR, ex, "Could not get FML version information - corrupted installation detected!");
}
}

View file

@ -13,7 +13,7 @@
package cpw.mods.fml.relauncher;
import java.io.File;
import java.util.logging.Level;
import org.apache.logging.log4j.Level;
import net.minecraft.launchwrapper.LaunchClassLoader;
@ -92,7 +92,7 @@ public class FMLLaunchHandler
catch (Throwable t)
{
t.printStackTrace();
FMLRelaunchLog.log(Level.SEVERE, t, "An error occurred trying to configure the minecraft home at %s for Forge Mod Loader", minecraftHome.getAbsolutePath());
FMLRelaunchLog.log(Level.ERROR, t, "An error occurred trying to configure the minecraft home at %s for Forge Mod Loader", minecraftHome.getAbsolutePath());
throw Throwables.propagate(t);
}
}

View file

@ -1,73 +0,0 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.relauncher;
/**
* Copied from ConsoleLogFormatter for shared use on the client
*
*/
import java.io.PrintWriter;
import java.io.StringWriter;
import java.text.SimpleDateFormat;
import java.util.logging.Formatter;
import java.util.logging.Level;
import java.util.logging.LogRecord;
final class FMLLogFormatter extends Formatter
{
static final String LINE_SEPARATOR = System.getProperty("line.separator");
private SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
public String format(LogRecord record)
{
StringBuilder msg = new StringBuilder();
msg.append(this.dateFormat.format(Long.valueOf(record.getMillis())));
Level lvl = record.getLevel();
String name = lvl.getLocalizedName();
if ( name == null )
{
name = lvl.getName();
}
if ( ( name != null ) && ( name.length() > 0 ) )
{
msg.append(" [" + name + "] ");
}
else
{
msg.append(" ");
}
if (record.getLoggerName() != null)
{
msg.append("["+record.getLoggerName()+"] ");
}
else
{
msg.append("[] ");
}
msg.append(formatMessage(record));
msg.append(LINE_SEPARATOR);
Throwable thr = record.getThrown();
if (thr != null)
{
StringWriter thrDump = new StringWriter();
thr.printStackTrace(new PrintWriter(thrDump));
msg.append(thrDump.toString());
}
return msg.toString();
}
}

View file

@ -12,124 +12,15 @@
package cpw.mods.fml.relauncher;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.logging.ConsoleHandler;
import java.util.logging.FileHandler;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.LogManager;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
import net.minecraft.launchwrapper.LogWrapper;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.spi.LoggerContext;
import com.google.common.base.Throwables;
public class FMLRelaunchLog {
public class FMLRelaunchLog
{
private static class ConsoleLogWrapper extends Handler
{
@Override
public void publish(LogRecord record)
{
boolean currInt = Thread.interrupted();
try
{
ConsoleLogThread.recordQueue.put(record);
}
catch (InterruptedException e)
{
e.printStackTrace(errCache);
}
if (currInt)
{
Thread.currentThread().interrupt();
}
}
@Override
public void flush()
{
}
@Override
public void close() throws SecurityException
{
}
}
private static class ConsoleLogThread implements Runnable
{
static ConsoleHandler wrappedHandler = new ConsoleHandler();
static LinkedBlockingQueue<LogRecord> recordQueue = new LinkedBlockingQueue<LogRecord>();
@Override
public void run()
{
do
{
LogRecord lr;
try
{
lr = recordQueue.take();
wrappedHandler.publish(lr);
}
catch (InterruptedException e)
{
e.printStackTrace(errCache);
Thread.interrupted();
// Stupid
}
}
while (true);
}
}
private static class LoggingOutStream extends ByteArrayOutputStream
{
private Logger log;
private StringBuilder currentMessage;
public LoggingOutStream(Logger log)
{
this.log = log;
this.currentMessage = new StringBuilder();
}
@Override
public void flush() throws IOException
{
String record;
synchronized(FMLRelaunchLog.class)
{
super.flush();
record = this.toString();
super.reset();
currentMessage.append(record.replace(FMLLogFormatter.LINE_SEPARATOR, "\n"));
// Are we longer than just the line separator?
int lastIdx = -1;
int idx = currentMessage.indexOf("\n",lastIdx+1);
while (idx >= 0)
{
log.log(Level.INFO, currentMessage.substring(lastIdx+1,idx));
lastIdx = idx;
idx = currentMessage.indexOf("\n",lastIdx+1);
}
if (lastIdx >= 0)
{
String rem = currentMessage.substring(lastIdx+1);
currentMessage.setLength(0);
currentMessage.append(rem);
}
}
}
}
/**
* Our special logger for logging issues to. We copy various assets from the
* Minecraft logger to achieve a similar appearance.
@ -139,97 +30,25 @@ public class FMLRelaunchLog
static File minecraftHome;
private static boolean configured;
private static Thread consoleLogThread;
private static PrintStream errCache;
private Logger myLog;
private static FileHandler fileHandler;
private static FMLLogFormatter formatter;
static String logFileNamePattern;
private FMLRelaunchLog()
{
}
/**
* Configure the FML logger
*/
private static void configureLogging()
{
LogManager.getLogManager().reset();
Logger globalLogger = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
globalLogger.setLevel(Level.OFF);
log.myLog = Logger.getLogger("ForgeModLoader");
LogWrapper.retarget(log.myLog);
Logger stdOut = Logger.getLogger("STDOUT");
stdOut.setParent(log.myLog);
Logger stdErr = Logger.getLogger("STDERR");
stdErr.setParent(log.myLog);
log.myLog.setLevel(Level.ALL);
log.myLog.setUseParentHandlers(false);
consoleLogThread = new Thread(new ConsoleLogThread());
consoleLogThread.setDaemon(true);
consoleLogThread.start();
formatter = new FMLLogFormatter();
try
{
File logPath = new File(minecraftHome, logFileNamePattern);
fileHandler = new FileHandler(logPath.getPath(), 0, 3)
{
public synchronized void close() throws SecurityException {
// We don't want this handler to reset
}
};
}
catch (Throwable t)
{
throw Throwables.propagate(t);
}
resetLoggingHandlers();
// Set system out to a log stream
errCache = System.err;
System.setOut(new PrintStream(new LoggingOutStream(stdOut), true));
System.setErr(new PrintStream(new LoggingOutStream(stdErr), true));
configured = true;
}
private static void resetLoggingHandlers()
{
ConsoleLogThread.wrappedHandler.setLevel(Level.parse(System.getProperty("fml.log.level","INFO")));
// Console handler captures the normal stderr before it gets replaced
log.myLog.addHandler(new ConsoleLogWrapper());
ConsoleLogThread.wrappedHandler.setFormatter(formatter);
fileHandler.setLevel(Level.ALL);
fileHandler.setFormatter(formatter);
log.myLog.addHandler(fileHandler);
log.myLog = LogManager.getLogger("FML");
}
public static void loadLogConfiguration(File logConfigFile)
public static void log(String targetLog, Level level, String format, Object... data)
{
if (logConfigFile!=null && logConfigFile.exists() && logConfigFile.canRead())
{
try
{
LogManager.getLogManager().readConfiguration(new FileInputStream(logConfigFile));
resetLoggingHandlers();
}
catch (Exception e)
{
log(Level.SEVERE, e, "Error reading logging configuration file %s", logConfigFile.getName());
}
}
}
public static void log(String logChannel, Level level, String format, Object... data)
{
makeLog(logChannel);
Logger.getLogger(logChannel).log(level, String.format(format, data));
LogManager.getLogger(targetLog).log(level, String.format(format, data));
}
public static void log(Level level, String format, Object... data)
@ -241,10 +60,9 @@ public class FMLRelaunchLog
log.myLog.log(level, String.format(format, data));
}
public static void log(String logChannel, Level level, Throwable ex, String format, Object... data)
public static void log(String targetLog, Level level, Throwable ex, String format, Object... data)
{
makeLog(logChannel);
Logger.getLogger(logChannel).log(level, String.format(format, data), ex);
LogManager.getLogger(targetLog).log(level, String.format(format, data), ex);
}
public static void log(Level level, Throwable ex, String format, Object... data)
@ -258,12 +76,12 @@ public class FMLRelaunchLog
public static void severe(String format, Object... data)
{
log(Level.SEVERE, format, data);
log(Level.ERROR, format, data);
}
public static void warning(String format, Object... data)
{
log(Level.WARNING, format, data);
log(Level.WARN, format, data);
}
public static void info(String format, Object... data)
@ -273,25 +91,16 @@ public class FMLRelaunchLog
public static void fine(String format, Object... data)
{
log(Level.FINE, format, data);
log(Level.DEBUG, format, data);
}
public static void finer(String format, Object... data)
{
log(Level.FINER, format, data);
log(Level.TRACE, format, data);
}
public static void finest(String format, Object... data)
{
log(Level.FINEST, format, data);
}
public Logger getLogger()
{
return myLog;
}
public static void makeLog(String logChannel)
{
Logger l = Logger.getLogger(logChannel);
l.setParent(log.myLog);
}
}

View file

@ -63,6 +63,12 @@ public interface IFMLLoadingPlugin
*/
void injectData(Map<String, Object> data);
/**
* Return an optional access transformer class for this coremod. It will be injected post-deobf
* so ensure your ATs conform to the new srgnames scheme.
* @return the name of an access transformer class or null if none is provided
*/
String getAccessTransformerClass();
/**
* Annotate your load plugin with a list of package prefixes that will *not* be

View file

@ -12,8 +12,9 @@
package net.minecraft.src;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
@ -32,8 +33,7 @@ public class FMLRenderAccessLibrary
{
public static Logger getLogger()
{
Logger l = Logger.getLogger("FMLRenderAccessLibrary");
l.setParent(FMLLog.getLogger());
Logger l = LogManager.getLogger("FMLRenderAccessLibrary");
return l;
}