Clean up Logging (#3953)

# Conflicts:
#	patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch
#	patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch
#	patches/minecraft/net/minecraft/entity/EntityList.java.patch
#	patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch
#	src/main/java/net/minecraftforge/oredict/OreDictionary.java
This commit is contained in:
diesieben07 2017-06-23 07:33:11 +02:00 committed by mezz
parent 68c6e7862e
commit 0e9820c51c
145 changed files with 806 additions and 785 deletions

View File

@ -12,9 +12,9 @@
if (!this.func_94310_b(stitcher$holder)) if (!this.func_94310_b(stitcher$holder))
{ {
String s = String.format("Unable to fit: %s - size: %dx%d - Maybe try a lowerresolution resourcepack?", stitcher$holder.func_98150_a().func_94215_i(), stitcher$holder.func_98150_a().func_94211_a(), stitcher$holder.func_98150_a().func_94216_b()); String s = String.format("Unable to fit: %s - size: %dx%d - Maybe try a lowerresolution resourcepack?", stitcher$holder.func_98150_a().func_94215_i(), stitcher$holder.func_98150_a().func_94211_a(), stitcher$holder.func_98150_a().func_94216_b());
+ net.minecraftforge.fml.common.FMLLog.info(s); + net.minecraftforge.fml.common.FMLLog.log.info(s);
+ for (Stitcher.Holder h : astitcher$holder) + for (Stitcher.Holder h : astitcher$holder)
+ net.minecraftforge.fml.common.FMLLog.info(" %s", h); + net.minecraftforge.fml.common.FMLLog.log.info(" {}", h);
throw new StitcherException(stitcher$holder, s); throw new StitcherException(stitcher$holder, s);
} }
} }

View File

@ -52,7 +52,7 @@
this.field_94258_i.clear(); this.field_94258_i.clear();
int j = Integer.MAX_VALUE; int j = Integer.MAX_VALUE;
int k = 1 << this.field_147636_j; int k = 1 << this.field_147636_j;
+ net.minecraftforge.fml.common.FMLLog.info("Max texture size: %d", i); + net.minecraftforge.fml.common.FMLLog.log.info("Max texture size: {}", i);
+ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar = net.minecraftforge.fml.common.ProgressManager.push("Texture stitching", skipFirst ? 0 : this.field_110574_e.size()); + net.minecraftforge.fml.common.ProgressManager.ProgressBar bar = net.minecraftforge.fml.common.ProgressManager.push("Texture stitching", skipFirst ? 0 : this.field_110574_e.size());
+ if(!skipFirst) + if(!skipFirst)

View File

@ -99,7 +99,7 @@
} }
@Nullable @Nullable
@@ -198,7 +215,17 @@ @@ -198,7 +215,16 @@
} }
else else
{ {
@ -109,15 +109,14 @@
+ } + }
+ catch (Exception e) + catch (Exception e)
+ { + {
+ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, e, + net.minecraftforge.fml.common.FMLLog.log.error("An Entity {}({}) has thrown an exception during loading, its state cannot be restored. Report this to the mod author",
+ "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"), entity.func_70005_c_(), e);
+ p_75615_0_.func_74779_i("id"), entity.func_70005_c_());
+ entity = null; + entity = null;
+ } + }
} }
return entity; return entity;
@@ -206,7 +233,7 @@ @@ -206,7 +232,7 @@
public static Set<ResourceLocation> func_180124_b() public static Set<ResourceLocation> func_180124_b()
{ {
@ -126,7 +125,7 @@
} }
public static boolean func_180123_a(Entity p_180123_0_, ResourceLocation p_180123_1_) public static boolean func_180123_a(Entity p_180123_0_, ResourceLocation p_180123_1_)
@@ -373,7 +400,7 @@ @@ -373,7 +399,7 @@
func_191305_a("zombie_horse", 3232308, 9945732); func_191305_a("zombie_horse", 3232308, 9945732);
func_191305_a("zombie_pigman", 15373203, 5009705); func_191305_a("zombie_pigman", 15373203, 5009705);
func_191305_a("zombie_villager", 5651507, 7969893); func_191305_a("zombie_villager", 5651507, 7969893);
@ -135,7 +134,7 @@
} }
private static void func_191303_a(int p_191303_0_, String p_191303_1_, Class <? extends Entity > p_191303_2_, String p_191303_3_) private static void func_191303_a(int p_191303_0_, String p_191303_1_, Class <? extends Entity > p_191303_2_, String p_191303_3_)
@@ -394,22 +421,19 @@ @@ -394,22 +420,19 @@
else else
{ {
ResourceLocation resourcelocation = new ResourceLocation(p_191303_1_); ResourceLocation resourcelocation = new ResourceLocation(p_191303_1_);

View File

@ -4,7 +4,7 @@
public void func_151394_a(ItemStack p_151394_1_, ItemStack p_151394_2_, float p_151394_3_) public void func_151394_a(ItemStack p_151394_1_, ItemStack p_151394_2_, float p_151394_3_)
{ {
+ if (func_151395_a(p_151394_1_) != ItemStack.field_190927_a) { net.minecraftforge.fml.common.FMLLog.info("Ignored smelting recipe with conflicting input: " + p_151394_1_ + " = " + p_151394_2_); return; } + if (func_151395_a(p_151394_1_) != ItemStack.field_190927_a) { net.minecraftforge.fml.common.FMLLog.log.info("Ignored smelting recipe with conflicting input: {} = {}", p_151394_1_, p_151394_2_); return; }
this.field_77604_b.put(p_151394_1_, p_151394_2_); this.field_77604_b.put(p_151394_1_, p_151394_2_);
this.field_77605_c.put(p_151394_2_, Float.valueOf(p_151394_3_)); this.field_77605_c.put(p_151394_2_, Float.valueOf(p_151394_3_));
} }

View File

@ -44,27 +44,25 @@
if (oclass != null) if (oclass != null)
{ {
@@ -103,6 +108,9 @@ @@ -103,6 +108,8 @@
catch (Throwable throwable1) catch (Throwable throwable1)
{ {
field_145852_a.error("Failed to create block entity {}", s, throwable1); field_145852_a.error("Failed to create block entity {}", s, throwable1);
+ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, throwable1, + net.minecraftforge.fml.common.FMLLog.log.error("A TileEntity {}({}) has thrown an exception during loading, its state cannot be restored. Report this to the mod author",
+ "A TileEntity %s(%s) has thrown an exception during loading, its state cannot be restored. Report this to the mod author", + s, oclass == null ? null : oclass.getName(), throwable1);
+ s, oclass.getName());
} }
if (tileentity != null) if (tileentity != null)
@@ -115,6 +123,9 @@ @@ -115,6 +122,8 @@
catch (Throwable throwable) catch (Throwable throwable)
{ {
field_145852_a.error("Failed to load data for block entity {}", s, throwable); field_145852_a.error("Failed to load data for block entity {}", s, throwable);
+ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, throwable, + net.minecraftforge.fml.common.FMLLog.log.error("A TileEntity {}({}) has thrown an exception during loading, its state cannot be restored. Report this to the mod author",
+ "A TileEntity %s(%s) has thrown an exception during loading, its state cannot be restored. Report this to the mod author", + s, oclass.getName(), throwable);
+ s, oclass.getName());
tileentity = null; tileentity = null;
} }
} }
@@ -156,7 +167,6 @@ @@ -156,7 +165,6 @@
} }
} }
@ -72,7 +70,7 @@
public double func_145835_a(double p_145835_1_, double p_145835_3_, double p_145835_5_) public double func_145835_a(double p_145835_1_, double p_145835_3_, double p_145835_5_)
{ {
double d0 = (double)this.field_174879_c.func_177958_n() + 0.5D - p_145835_1_; double d0 = (double)this.field_174879_c.func_177958_n() + 0.5D - p_145835_1_;
@@ -297,6 +307,204 @@ @@ -297,6 +305,204 @@
{ {
} }

View File

@ -13,7 +13,7 @@
+ { + {
+ p_i1098_1_ = "MissingName"; + p_i1098_1_ = "MissingName";
+ p_i1098_2_ = p_i1098_3_ = "NotValid"; + p_i1098_2_ = p_i1098_3_ = "NotValid";
+ org.apache.logging.log4j.Logger logger = net.minecraftforge.fml.common.FMLLog.getLogger(); + org.apache.logging.log4j.Logger logger = net.minecraftforge.fml.common.FMLLog.log;
+ logger.log(org.apache.logging.log4j.Level.WARN, "========================================================="); + logger.log(org.apache.logging.log4j.Level.WARN, "=========================================================");
+ logger.log(org.apache.logging.log4j.Level.WARN, "WARNING!! the username was not set for this session, typically"); + logger.log(org.apache.logging.log4j.Level.WARN, "WARNING!! the username was not set for this session, typically");
+ logger.log(org.apache.logging.log4j.Level.WARN, "this means you installed Forge incorrectly. We have set your"); + logger.log(org.apache.logging.log4j.Level.WARN, "this means you installed Forge incorrectly. We have set your");

View File

@ -385,7 +385,7 @@
+ if (net.minecraftforge.common.ForgeModContainer.removeErroringEntities) + if (net.minecraftforge.common.ForgeModContainer.removeErroringEntities)
+ { + {
+ net.minecraftforge.fml.common.FMLLog.severe(crashreport.func_71502_e()); + net.minecraftforge.fml.common.FMLLog.log.fatal(crashreport.func_71502_e());
+ func_72900_e(entity); + func_72900_e(entity);
+ } + }
+ else + else
@ -398,7 +398,7 @@
entity2.func_85029_a(crashreportcategory1); entity2.func_85029_a(crashreportcategory1);
+ if (net.minecraftforge.common.ForgeModContainer.removeErroringEntities) + if (net.minecraftforge.common.ForgeModContainer.removeErroringEntities)
+ { + {
+ net.minecraftforge.fml.common.FMLLog.severe(crashreport1.func_71502_e()); + net.minecraftforge.fml.common.FMLLog.log.fatal(crashreport1.func_71502_e());
+ func_72900_e(entity2); + func_72900_e(entity2);
+ } + }
+ else + else
@ -425,7 +425,7 @@
tileentity.func_145828_a(crashreportcategory2); tileentity.func_145828_a(crashreportcategory2);
+ if (net.minecraftforge.common.ForgeModContainer.removeErroringTileEntities) + if (net.minecraftforge.common.ForgeModContainer.removeErroringTileEntities)
+ { + {
+ net.minecraftforge.fml.common.FMLLog.severe(crashreport2.func_71502_e()); + net.minecraftforge.fml.common.FMLLog.log.fatal(crashreport2.func_71502_e());
+ tileentity.func_145843_s(); + tileentity.func_145843_s();
+ this.func_175713_t(tileentity.func_174877_v()); + this.func_175713_t(tileentity.func_174877_v());
+ } + }

View File

@ -310,11 +310,11 @@
+ private void logCascadingWorldGeneration() + private void logCascadingWorldGeneration()
+ { + {
+ net.minecraftforge.fml.common.ModContainer activeModContainer = net.minecraftforge.fml.common.Loader.instance().activeModContainer(); + net.minecraftforge.fml.common.ModContainer activeModContainer = net.minecraftforge.fml.common.Loader.instance().activeModContainer();
+ String format = "%s loaded a new chunk (%d, %d Dimension: %d) during chunk population, causing cascading worldgen lag. Please report this to the mod's issue tracker. This log can be disabled in the Forge config."; + String format = "{} loaded a new chunk ({}, {} Dimension: {}) during chunk population, causing cascading worldgen lag. Please report this to the mod's issue tracker. This log can be disabled in the Forge config.";
+ +
+ if (activeModContainer == null) // vanilla minecraft has problems too (MC-114332), log it at a quieter level. + if (activeModContainer == null) // vanilla minecraft has problems too (MC-114332), log it at a quieter level.
+ net.minecraftforge.fml.common.FMLLog.fine(format, "Minecraft", this.field_76635_g, this.field_76647_h, this.field_76637_e.field_73011_w.getDimension()); + net.minecraftforge.fml.common.FMLLog.log.debug(format, "Minecraft", this.field_76635_g, this.field_76647_h, this.field_76637_e.field_73011_w.getDimension());
+ else + else
+ net.minecraftforge.fml.common.FMLLog.warning(format, activeModContainer.getName(), this.field_76635_g, this.field_76647_h, this.field_76637_e.field_73011_w.getDimension()); + net.minecraftforge.fml.common.FMLLog.log.warn(format, activeModContainer.getName(), this.field_76635_g, this.field_76647_h, this.field_76637_e.field_73011_w.getDimension());
+ } + }
} }

View File

@ -107,7 +107,7 @@
this.func_75824_a(p_75816_2_.func_76632_l(), nbttagcompound); this.func_75824_a(p_75816_2_.func_76632_l(), nbttagcompound);
} }
catch (Exception exception) catch (Exception exception)
@@ -305,11 +366,20 @@ @@ -305,11 +366,19 @@
{ {
NBTTagCompound nbttagcompound2 = new NBTTagCompound(); NBTTagCompound nbttagcompound2 = new NBTTagCompound();
@ -121,14 +121,13 @@
+ } + }
+ catch (Exception e) + catch (Exception e)
+ { + {
+ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, e, + net.minecraftforge.fml.common.FMLLog.log.error("An Entity type {} has thrown an exception trying to write state. It will not persist. Report this to the mod author",
+ "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(), e);
+ entity.getClass().getName());
+ } + }
} }
} }
@@ -318,8 +388,17 @@ @@ -318,8 +387,16 @@
for (TileEntity tileentity : p_75820_1_.func_177434_r().values()) for (TileEntity tileentity : p_75820_1_.func_177434_r().values())
{ {
@ -139,14 +138,13 @@
+ } + }
+ catch (Exception e) + catch (Exception e)
+ { + {
+ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, e, + net.minecraftforge.fml.common.FMLLog.log.error("A TileEntity type {} has throw an exception trying to write state. It will not persist. Report this to the mod author",
+ "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(), e);
+ tileentity.getClass().getName());
+ } + }
} }
p_75820_3_.func_74782_a("TileEntities", nbttaglist2); p_75820_3_.func_74782_a("TileEntities", nbttaglist2);
@@ -388,6 +467,12 @@ @@ -388,6 +465,12 @@
chunk.func_76616_a(p_75823_2_.func_74770_j("Biomes")); chunk.func_76616_a(p_75823_2_.func_74770_j("Biomes"));
} }
@ -159,7 +157,7 @@
NBTTagList nbttaglist1 = p_75823_2_.func_150295_c("Entities", 10); NBTTagList nbttaglist1 = p_75823_2_.func_150295_c("Entities", 10);
for (int j1 = 0; j1 < nbttaglist1.func_74745_c(); ++j1) for (int j1 = 0; j1 < nbttaglist1.func_74745_c(); ++j1)
@@ -431,8 +516,6 @@ @@ -431,8 +514,6 @@
p_75823_1_.func_180497_b(new BlockPos(nbttagcompound3.func_74762_e("x"), nbttagcompound3.func_74762_e("y"), nbttagcompound3.func_74762_e("z")), block, nbttagcompound3.func_74762_e("t"), nbttagcompound3.func_74762_e("p")); p_75823_1_.func_180497_b(new BlockPos(nbttagcompound3.func_74762_e("x"), nbttagcompound3.func_74762_e("y"), nbttagcompound3.func_74762_e("z")), block, nbttagcompound3.func_74762_e("t"), nbttagcompound3.func_74762_e("p"));
} }
} }

View File

@ -29,7 +29,7 @@
+ chunk = net.minecraftforge.common.ForgeChunkManager.fetchDormantChunk(pos, this.field_73251_h); + chunk = net.minecraftforge.common.ForgeChunkManager.fetchDormantChunk(pos, this.field_73251_h);
+ if (chunk != null || !(this.field_73247_e instanceof net.minecraft.world.chunk.storage.AnvilChunkLoader)) + if (chunk != null || !(this.field_73247_e instanceof net.minecraft.world.chunk.storage.AnvilChunkLoader))
{ {
+ if (!loadingChunks.add(pos)) net.minecraftforge.fml.common.FMLLog.bigWarning("There is an attempt to load a chunk (%d,%d) in dimension %d that is already being loaded. This will cause weird chunk breakages.", p_186028_1_, p_186028_2_, this.field_73251_h.field_73011_w.getDimension()); + if (!loadingChunks.add(pos)) net.minecraftforge.fml.common.FMLLog.bigWarning("There is an attempt to load a chunk ({},{}) in dimension {} that is already being loaded. This will cause weird chunk breakages.", p_186028_1_, p_186028_2_, this.field_73251_h.field_73011_w.getDimension());
+ if (chunk == null) chunk = this.func_73239_e(p_186028_1_, p_186028_2_); + if (chunk == null) chunk = this.func_73239_e(p_186028_1_, p_186028_2_);
+ +
+ if (chunk != null) + if (chunk != null)

View File

@ -512,7 +512,7 @@ public class ForgeHooksClient
glEnableVertexAttribArray(attr.getIndex()); glEnableVertexAttribArray(attr.getIndex());
glVertexAttribPointer(attr.getIndex(), count, constant, false, stride, buffer); glVertexAttribPointer(attr.getIndex(), count, constant, false, stride, buffer);
default: default:
FMLLog.severe("Unimplemented vanilla attribute upload: %s", attrType.getDisplayName()); FMLLog.log.fatal("Unimplemented vanilla attribute upload: {}", attrType.getDisplayName());
} }
} }
@ -542,7 +542,7 @@ public class ForgeHooksClient
case GENERIC: case GENERIC:
glDisableVertexAttribArray(attr.getIndex()); glDisableVertexAttribArray(attr.getIndex());
default: default:
FMLLog.severe("Unimplemented vanilla attribute upload: %s", attrType.getDisplayName()); FMLLog.log.fatal("Unimplemented vanilla attribute upload: {}", attrType.getDisplayName());
} }
} }

View File

@ -188,9 +188,9 @@ public class ForgeBlockStateV1 extends Marker
String value = v.textures.get(tex.getValue().substring(1)); String value = v.textures.get(tex.getValue().substring(1));
if (value == null) if (value == null)
{ {
FMLLog.severe("Could not resolve texture name \"" + tex.getValue() + "\" for permutation \"" + e.getKey() + "\""); FMLLog.log.fatal("Could not resolve texture name \"{}\" for permutation \"{}\"", tex.getValue(), e.getKey());
for (Entry<String, String> t: v.textures.entrySet()) for (Entry<String, String> t: v.textures.entrySet())
FMLLog.severe(t.getKey() + "=" + t.getValue()); FMLLog.log.fatal("{}={}", t.getKey(), t.getValue());
throw new JsonParseException("Could not resolve texture name \"" + tex.getValue() + "\" for permutation \"" + e.getKey() + "\""); throw new JsonParseException("Could not resolve texture name \"" + tex.getValue() + "\" for permutation \"" + e.getKey() + "\"");
} }
v.textures.put(tex.getKey(), value); v.textures.put(tex.getKey(), value);

View File

@ -433,7 +433,7 @@ public final class ModelFluid implements IModelCustomData
String fluid = e.getAsString(); String fluid = e.getAsString();
if(!FluidRegistry.isFluidRegistered(fluid)) if(!FluidRegistry.isFluidRegistered(fluid))
{ {
FMLLog.severe("fluid '%s' not found", fluid); FMLLog.log.fatal("fluid '{}' not found", fluid);
return WATER; return WATER;
} }
return new ModelFluid(FluidRegistry.getFluid(fluid)); return new ModelFluid(FluidRegistry.getFluid(fluid));

View File

@ -329,7 +329,7 @@ public final class ModelLoader extends ModelBakery
catch(Exception normalException) catch(Exception normalException)
{ {
// try blockstate json if the item model is missing // try blockstate json if the item model is missing
FMLLog.fine("Item json isn't found for '" + memory + "', trying to load the variant from the blockstate json"); FMLLog.log.debug("Item json isn't found for '{}', trying to load the variant from the blockstate json", memory);
try try
{ {
model = ModelLoaderRegistry.getModel(memory); model = ModelLoaderRegistry.getModel(memory);
@ -362,7 +362,7 @@ public final class ModelLoader extends ModelBakery
} }
catch (Exception exception) catch (Exception exception)
{ {
FMLLog.getLogger().error("Could not load the forge bucket model from the blockstate", exception); FMLLog.log.error("Could not load the forge bucket model from the blockstate", exception);
return; return;
} }
} }
@ -1081,17 +1081,17 @@ public final class ModelLoader extends ModelBakery
if(entry.getValue() instanceof ItemLoadingException) if(entry.getValue() instanceof ItemLoadingException)
{ {
ItemLoadingException ex = (ItemLoadingException)entry.getValue(); ItemLoadingException ex = (ItemLoadingException)entry.getValue();
FMLLog.getLogger().error(errorMsg + ", normal location exception: ", ex.normalException); FMLLog.log.error("{}, normal location exception: ", errorMsg, ex.normalException);
FMLLog.getLogger().error(errorMsg + ", blockstate location exception: ", ex.blockstateException); FMLLog.log.error("{}, blockstate location exception: ", errorMsg, ex.blockstateException);
} }
else else
{ {
FMLLog.getLogger().error(errorMsg, entry.getValue()); FMLLog.log.error(errorMsg, entry.getValue());
} }
ResourceLocation blockstateLocation = new ResourceLocation(location.getResourceDomain(), location.getResourcePath()); ResourceLocation blockstateLocation = new ResourceLocation(location.getResourceDomain(), location.getResourcePath());
if(loadingExceptions.containsKey(blockstateLocation) && !printedBlockStateErrors.contains(blockstateLocation)) if(loadingExceptions.containsKey(blockstateLocation) && !printedBlockStateErrors.contains(blockstateLocation))
{ {
FMLLog.getLogger().error("Exception loading blockstate for the variant " + location + ": ", loadingExceptions.get(blockstateLocation)); FMLLog.log.error("Exception loading blockstate for the variant {}: ", location, loadingExceptions.get(blockstateLocation));
printedBlockStateErrors.add(blockstateLocation); printedBlockStateErrors.add(blockstateLocation);
} }
} }
@ -1114,7 +1114,7 @@ public final class ModelLoader extends ModelBakery
errorCount++; errorCount++;
if(errorCount < verboseMissingInfoCount) if(errorCount < verboseMissingInfoCount)
{ {
FMLLog.severe("Model definition for location %s not found", missing); FMLLog.log.fatal("Model definition for location {} not found", missing);
} }
modelErrors.put(domain, errorCount); modelErrors.put(domain, errorCount);
} }
@ -1127,7 +1127,7 @@ public final class ModelLoader extends ModelBakery
{ {
if(e.getValue() >= verboseMissingInfoCount) if(e.getValue() >= verboseMissingInfoCount)
{ {
FMLLog.severe("Suppressed additional %s model loading errors for domain %s", e.getValue() - verboseMissingInfoCount, e.getKey()); FMLLog.log.fatal("Suppressed additional {} model loading errors for domain {}", e.getValue() - verboseMissingInfoCount, e.getKey());
} }
} }
isLoading = false; isLoading = false;

View File

@ -204,7 +204,7 @@ public class ModelLoaderRegistry
} }
catch(Exception e) catch(Exception e)
{ {
FMLLog.getLogger().error(error, e); FMLLog.log.error(error, e);
return getMissingModel(location, e); return getMissingModel(location, e);
} }
} }

View File

@ -134,7 +134,7 @@ public final class MultiLayerModel implements IModelCustomData
{ {
return new ModelResourceLocation(e.getAsString()); return new ModelResourceLocation(e.getAsString());
} }
FMLLog.severe("Expect ModelResourceLocation, got: ", json); FMLLog.log.fatal("Expect ModelResourceLocation, got: {}", json);
return new ModelResourceLocation("builtin/missing", "missing"); return new ModelResourceLocation("builtin/missing", "missing");
} }

View File

@ -291,7 +291,7 @@ public final class MultiModel implements IModel
if(bakedBase == null && parts.isEmpty()) if(bakedBase == null && parts.isEmpty())
{ {
FMLLog.log(Level.ERROR, "MultiModel %s is empty (no base model or parts were provided/resolved)", location); FMLLog.log.error("MultiModel {} is empty (no base model or parts were provided/resolved)", location);
IModel missing = ModelLoaderRegistry.getMissingModel(); IModel missing = ModelLoaderRegistry.getMissingModel();
return missing.bake(missing.getDefaultState(), format, bakedTextureGetter); return missing.bake(missing.getDefaultState(), format, bakedTextureGetter);
} }

View File

@ -577,12 +577,12 @@ public class ModelBlockAnimation
} }
catch(IOException e) catch(IOException e)
{ {
FMLLog.log(Level.ERROR, e, "Exception loading vanilla model animation %s, skipping", armatureLocation); FMLLog.log.error("Exception loading vanilla model animation {}, skipping", armatureLocation, e);
return defaultModelBlockAnimation; return defaultModelBlockAnimation;
} }
catch(JsonParseException e) catch(JsonParseException e)
{ {
FMLLog.log(Level.ERROR, e, "Exception loading vanilla model animation %s, skipping", armatureLocation); FMLLog.log.error("Exception loading vanilla model animation {}, skipping", armatureLocation, e);
return defaultModelBlockAnimation; return defaultModelBlockAnimation;
} }
} }

View File

@ -508,7 +508,7 @@ public enum B3DLoader implements ICustomModelLoader
{ {
if(e.getValue().getResourcePath().startsWith("#")) if(e.getValue().getResourcePath().startsWith("#"))
{ {
FMLLog.severe("unresolved texture '%s' for b3d model '%s'", e.getValue().getResourcePath(), modelLocation); FMLLog.log.fatal("unresolved texture '{}' for b3d model '{}'", e.getValue().getResourcePath(), modelLocation);
builder.put(e.getKey(), missing); builder.put(e.getKey(), missing);
} }
else else
@ -563,7 +563,7 @@ public enum B3DLoader implements ICustomModelLoader
} }
else else
{ {
FMLLog.severe("unknown mesh definition '%s' in array for b3d model '%s'", s.toString(), modelLocation); FMLLog.log.fatal("unknown mesh definition '{}' in array for b3d model '{}'", s.toString(), modelLocation);
return this; return this;
} }
} }
@ -571,7 +571,7 @@ public enum B3DLoader implements ICustomModelLoader
} }
else else
{ {
FMLLog.severe("unknown mesh definition '%s' for b3d model '%s'", e.toString(), modelLocation); FMLLog.log.fatal("unknown mesh definition '{}' for b3d model '{}'", e.toString(), modelLocation);
return this; return this;
} }
} }
@ -584,7 +584,7 @@ public enum B3DLoader implements ICustomModelLoader
} }
else else
{ {
FMLLog.severe("unknown keyframe definition '%s' for b3d model '%s'", e.toString(), modelLocation); FMLLog.log.fatal("unknown keyframe definition '{}' for b3d model '{}'", e.toString(), modelLocation);
return this; return this;
} }
} }

View File

@ -139,7 +139,7 @@ public class B3DModel
{ {
if(texture > textures.size()) if(texture > textures.size())
{ {
logger.error(String.format("texture %s is out of range", texture)); logger.error("texture {} is out of range", texture);
return null; return null;
} }
else if(texture == -1) return Texture.White; else if(texture == -1) return Texture.White;
@ -152,7 +152,7 @@ public class B3DModel
{ {
if(brush > brushes.size()) if(brush > brushes.size())
{ {
logger.error(String.format("brush %s is out of range", brush)); logger.error("brush {} is out of range", brush);
return null; return null;
} }
else if(brush == -1) return null; else if(brush == -1) return null;
@ -165,7 +165,7 @@ public class B3DModel
{ {
if(vertex > vertices.size()) if(vertex > vertices.size())
{ {
logger.error(String.format("vertex %s is out of range", vertex)); logger.error("vertex {} is out of range", vertex);
return null; return null;
} }
return vertices.get(vertex); return vertices.get(vertex);
@ -408,17 +408,17 @@ public class B3DModel
{ {
if(pos != null) if(pos != null)
{ {
if(oldKey.getPos() != null) logger.error("Duplicate keys: %s and %s (ignored)", oldKey, key); if(oldKey.getPos() != null) logger.error("Duplicate keys: {} and {} (ignored)", oldKey, key);
else key = new Key(oldKey.getPos(), key.getScale(), key.getRot()); else key = new Key(oldKey.getPos(), key.getScale(), key.getRot());
} }
if(scale != null) if(scale != null)
{ {
if(oldKey.getScale() != null) logger.error("Duplicate keys: %s and %s (ignored)", oldKey, key); if(oldKey.getScale() != null) logger.error("Duplicate keys: {} and {} (ignored)", oldKey, key);
else key = new Key(key.getPos(), oldKey.getScale(), key.getRot()); else key = new Key(key.getPos(), oldKey.getScale(), key.getRot());
} }
if(rot != null) if(rot != null)
{ {
if(oldKey.getRot() != null) logger.error("Duplicate keys: %s and %s (ignored)", oldKey, key); if(oldKey.getRot() != null) logger.error("Duplicate keys: {} and {} (ignored)", oldKey, key);
else key = new Key(key.getPos(), key.getScale(), oldKey.getRot()); else key = new Key(key.getPos(), key.getScale(), oldKey.getRot());
} }
} }

View File

@ -51,7 +51,7 @@ public enum OBJLoader implements ICustomModelLoader {
public void addDomain(String domain) public void addDomain(String domain)
{ {
enabledDomains.add(domain.toLowerCase()); enabledDomains.add(domain.toLowerCase());
FMLLog.log(Level.INFO, "OBJLoader: Domain %s has been added.", domain.toLowerCase()); FMLLog.log.info("OBJLoader: Domain {} has been added.", domain.toLowerCase());
} }
@Override @Override

View File

@ -128,7 +128,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData
{ {
if (e.getValue().getTexture().getTextureLocation().getResourcePath().startsWith("#")) if (e.getValue().getTexture().getTextureLocation().getResourcePath().startsWith("#"))
{ {
FMLLog.severe("OBJLoader: Unresolved texture '%s' for obj model '%s'", e.getValue().getTexture().getTextureLocation().getResourcePath(), modelLocation); FMLLog.log.fatal("OBJLoader: Unresolved texture '{}' for obj model '{}'", e.getValue().getTexture().getTextureLocation().getResourcePath(), modelLocation);
builder.put(e.getKey(), missing); builder.put(e.getKey(), missing);
} }
else else
@ -285,7 +285,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData
else if (key.equalsIgnoreCase("f")) // Face Elements: f v1[/vt1][/vn1] ... else if (key.equalsIgnoreCase("f")) // Face Elements: f v1[/vt1][/vn1] ...
{ {
if (splitData.length > 4) if (splitData.length > 4)
FMLLog.warning("OBJModel.Parser: found a face ('f') with more than 4 vertices, only the first 4 of these vertices will be rendered!"); FMLLog.log.warn("OBJModel.Parser: found a face ('f') with more than 4 vertices, only the first 4 of these vertices will be rendered!");
List<Vertex> v = Lists.newArrayListWithCapacity(splitData.length); List<Vertex> v = Lists.newArrayListWithCapacity(splitData.length);
@ -368,7 +368,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData
if (!unknownObjectCommands.contains(key)) if (!unknownObjectCommands.contains(key))
{ {
unknownObjectCommands.add(key); unknownObjectCommands.add(key);
FMLLog.info("OBJLoader.Parser: command '%s' (model: '%s') is not currently supported, skipping. Line: %d '%s'", key, objFrom, lineNum, currentLine); FMLLog.log.info("OBJLoader.Parser: command '{}' (model: '{}') is not currently supported, skipping. Line: {} '{}'", key, objFrom, lineNum, currentLine);
} }
} }
} }
@ -545,7 +545,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData
} }
else else
{ {
FMLLog.info("OBJModel: A color has already been defined for material '%s' in '%s'. The color defined by key '%s' will not be applied!", material.getName(), new ResourceLocation(domain, path).toString(), key); FMLLog.log.info("OBJModel: A color has already been defined for material '{}' in '{}'. The color defined by key '{}' will not be applied!", material.getName(), new ResourceLocation(domain, path).toString(), key);
} }
} }
else if (key.equalsIgnoreCase("map_Ka") || key.equalsIgnoreCase("map_Kd") || key.equalsIgnoreCase("map_Ks")) else if (key.equalsIgnoreCase("map_Ka") || key.equalsIgnoreCase("map_Kd") || key.equalsIgnoreCase("map_Ks"))
@ -569,7 +569,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData
} }
else else
{ {
FMLLog.info("OBJModel: A texture has already been defined for material '%s' in '%s'. The texture defined by key '%s' will not be applied!", material.getName(), new ResourceLocation(domain, path).toString(), key); FMLLog.log.info("OBJModel: A texture has already been defined for material '{}' in '{}'. The texture defined by key '{}' will not be applied!", material.getName(), new ResourceLocation(domain, path).toString(), key);
} }
} }
else if (key.equalsIgnoreCase("d") || key.equalsIgnoreCase("Tr")) else if (key.equalsIgnoreCase("d") || key.equalsIgnoreCase("Tr"))
@ -585,7 +585,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData
if (!unknownMaterialCommands.contains(key)) if (!unknownMaterialCommands.contains(key))
{ {
unknownMaterialCommands.add(key); unknownMaterialCommands.add(key);
FMLLog.info("OBJLoader.MaterialLibrary: key '%s' (model: '%s') is not currently supported, skipping", key, new ResourceLocation(domain, path)); FMLLog.log.info("OBJLoader.MaterialLibrary: key '{}' (model: '{}') is not currently supported, skipping", key, new ResourceLocation(domain, path));
} }
} }
} }

View File

@ -373,7 +373,7 @@ public class BiomeDictionary
if (!hasAnyType(biome)) if (!hasAnyType(biome))
{ {
makeBestGuess(biome); makeBestGuess(biome);
FMLLog.warning("No types have been added to Biome %s, types have been assigned on a best-effort guess: %s", biome.getRegistryName(), getTypes(biome)); FMLLog.log.warn("No types have been added to Biome {}, types have been assigned on a best-effort guess: {}", biome.getRegistryName(), getTypes(biome));
} }
} }

View File

@ -169,11 +169,11 @@ public class DimensionManager
int leakCount = leakedWorlds.count(System.identityHashCode(w)); int leakCount = leakedWorlds.count(System.identityHashCode(w));
if (leakCount == 5) if (leakCount == 5)
{ {
FMLLog.fine("The world %x (%s) may have leaked: first encounter (5 occurrences).\n", System.identityHashCode(w), w.getWorldInfo().getWorldName()); FMLLog.log.debug("The world {} ({}) may have leaked: first encounter (5 occurrences).\n", Integer.toHexString(System.identityHashCode(w)), w.getWorldInfo().getWorldName());
} }
else if (leakCount % 5 == 0) else if (leakCount % 5 == 0)
{ {
FMLLog.fine("The world %x (%s) may have leaked: seen %d times.\n", System.identityHashCode(w), w.getWorldInfo().getWorldName(), leakCount); FMLLog.log.debug("The world {} ({}) may have leaked: seen {} times.\n", Integer.toHexString(System.identityHashCode(w)), w.getWorldInfo().getWorldName(), leakCount);
} }
} }
} }
@ -191,13 +191,13 @@ public class DimensionManager
worlds.put(id, world); worlds.put(id, world);
weakWorldMap.put(world, world); weakWorldMap.put(world, world);
server.worldTickTimes.put(id, new long[100]); server.worldTickTimes.put(id, new long[100]);
FMLLog.info("Loading dimension %d (%s) (%s)", id, world.getWorldInfo().getWorldName(), world.getMinecraftServer()); FMLLog.log.info("Loading dimension {} ({}) ({})", id, world.getWorldInfo().getWorldName(), world.getMinecraftServer());
} }
else else
{ {
worlds.remove(id); worlds.remove(id);
server.worldTickTimes.remove(id); server.worldTickTimes.remove(id);
FMLLog.info("Unloading dimension %d", id); FMLLog.log.info("Unloading dimension {}", id);
} }
ArrayList<WorldServer> tmp = new ArrayList<WorldServer>(); ArrayList<WorldServer> tmp = new ArrayList<WorldServer>();
@ -292,8 +292,8 @@ public class DimensionManager
} }
catch (Exception e) catch (Exception e)
{ {
FMLCommonHandler.instance().getFMLLogger().log(Level.ERROR, String.format("An error occurred trying to create an instance of WorldProvider %d (%s)", FMLLog.log.error("An error occurred trying to create an instance of WorldProvider {} ({})",
dim, getProviderType(dim)),e); dim, getProviderType(dim), e);
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }
@ -307,7 +307,7 @@ public class DimensionManager
{ {
if(!unloadQueue.contains(id)) if(!unloadQueue.contains(id))
{ {
FMLLog.fine("Queueing dimension %s to unload", id); FMLLog.log.debug("Queueing dimension {} to unload", id);
unloadQueue.add(id); unloadQueue.add(id);
} }
else else
@ -339,7 +339,7 @@ public class DimensionManager
dimension.ticksWaited = 0; dimension.ticksWaited = 0;
if (w == null || !ForgeChunkManager.getPersistentChunksFor(w).isEmpty() || !w.playerEntities.isEmpty() || dimension.type.shouldLoadSpawn()) //Don't unload the world if the status changed if (w == null || !ForgeChunkManager.getPersistentChunksFor(w).isEmpty() || !w.playerEntities.isEmpty() || dimension.type.shouldLoadSpawn()) //Don't unload the world if the status changed
{ {
FMLLog.fine("Aborting unload for dimension %s as status changed", id); FMLLog.log.debug("Aborting unload for dimension {} as status changed", id);
continue; continue;
} }
try try

View File

@ -263,7 +263,7 @@ public class ForgeChunkManager
} }
else else
{ {
FMLLog.log(Level.ERROR, "Attempt to create a player ticket without a valid player"); FMLLog.log.error("Attempt to create a player ticket without a valid player");
throw new RuntimeException(); throw new RuntimeException();
} }
} }
@ -277,7 +277,7 @@ public class ForgeChunkManager
{ {
if (depth > getMaxChunkDepthFor(modId) || (depth <= 0 && getMaxChunkDepthFor(modId) > 0)) if (depth > getMaxChunkDepthFor(modId) || (depth <= 0 && getMaxChunkDepthFor(modId) > 0))
{ {
FMLLog.warning("The mod %s tried to modify the chunk ticket depth to: %d, its allowed maximum is: %d", modId, depth, getMaxChunkDepthFor(modId)); FMLLog.log.warn("The mod {} tried to modify the chunk ticket depth to: {}, its allowed maximum is: {}", modId, depth, getMaxChunkDepthFor(modId));
} }
else else
{ {
@ -489,7 +489,7 @@ public class ForgeChunkManager
} }
catch (IOException e) catch (IOException e)
{ {
FMLLog.log(Level.WARN, e, "Unable to read forced chunk data at %s - it will be ignored", chunkLoaderData.getAbsolutePath()); FMLLog.log.warn("Unable to read forced chunk data at {} - it will be ignored", chunkLoaderData.getAbsolutePath(), e);
return; return;
} }
NBTTagList ticketList = forcedChunkData.getTagList("TicketList", Constants.NBT.TAG_COMPOUND); NBTTagList ticketList = forcedChunkData.getTagList("TicketList", Constants.NBT.TAG_COMPOUND);
@ -501,13 +501,13 @@ public class ForgeChunkManager
if (!isPlayer && !Loader.isModLoaded(modId)) if (!isPlayer && !Loader.isModLoaded(modId))
{ {
FMLLog.warning("Found chunkloading data for mod %s which is currently not available or active - it will be removed from the world save", modId); FMLLog.log.warn("Found chunkloading data for mod {} which is currently not available or active - it will be removed from the world save", modId);
continue; continue;
} }
if (!isPlayer && !callbacks.containsKey(modId)) if (!isPlayer && !callbacks.containsKey(modId))
{ {
FMLLog.warning("The mod %s has registered persistent chunkloading data but doesn't seem to want to be called back with it - it will be removed from the world save", modId); FMLLog.log.warn("The mod {} has registered persistent chunkloading data but doesn't seem to want to be called back with it - it will be removed from the world save", modId);
continue; continue;
} }
@ -561,7 +561,7 @@ public class ForgeChunkManager
{ {
if (tick.ticketType == Type.ENTITY && tick.entity == null) if (tick.ticketType == Type.ENTITY && tick.entity == null)
{ {
FMLLog.warning("Failed to load persistent chunkloading entity %s from store.", pendingEntities.inverse().get(tick)); FMLLog.log.warn("Failed to load persistent chunkloading entity {} from store.", pendingEntities.inverse().get(tick));
loadedTickets.remove(tick.modId, tick); loadedTickets.remove(tick.modId, tick);
} }
} }
@ -583,7 +583,7 @@ public class ForgeChunkManager
} }
if (tickets.size() > maxTicketLength) if (tickets.size() > maxTicketLength)
{ {
FMLLog.warning("The mod %s has too many open chunkloading tickets %d. Excess will be dropped", modId, tickets.size()); FMLLog.log.warn("The mod {} has too many open chunkloading tickets {}. Excess will be dropped", modId, tickets.size());
tickets.subList(maxTicketLength, tickets.size()).clear(); tickets.subList(maxTicketLength, tickets.size()).clear();
} }
ForgeChunkManager.tickets.get(world).putAll(modId, tickets); ForgeChunkManager.tickets.get(world).putAll(modId, tickets);
@ -641,7 +641,7 @@ public class ForgeChunkManager
ModContainer container = getContainer(mod); ModContainer container = getContainer(mod);
if (container == null) if (container == null)
{ {
FMLLog.warning("Unable to register a callback for an unknown mod %s (%s : %x)", mod, mod.getClass().getName(), System.identityHashCode(mod)); FMLLog.log.warn("Unable to register a callback for an unknown mod {} ({} : {})", mod, mod.getClass().getName(), Integer.toHexString(System.identityHashCode(mod)));
return; return;
} }
@ -699,12 +699,12 @@ public class ForgeChunkManager
ModContainer mc = getContainer(mod); ModContainer mc = getContainer(mod);
if (mc == null) if (mc == null)
{ {
FMLLog.log(Level.ERROR, "Failed to locate the container for mod instance %s (%s : %x)", mod, mod.getClass().getName(), System.identityHashCode(mod)); FMLLog.log.error("Failed to locate the container for mod instance {} ({} : {})", mod, mod.getClass().getName(), Integer.toHexString(System.identityHashCode(mod)));
return null; return null;
} }
if (playerTickets.get(player).size()>playerTicketLength) if (playerTickets.get(player).size()>playerTicketLength)
{ {
FMLLog.warning("Unable to assign further chunkloading tickets to player %s (on behalf of mod %s)", player, mc.getModId()); FMLLog.log.warn("Unable to assign further chunkloading tickets to player {} (on behalf of mod {})", player, mc.getModId());
return null; return null;
} }
Ticket ticket = new Ticket(mc.getModId(),type,world,player); Ticket ticket = new Ticket(mc.getModId(),type,world,player);
@ -726,13 +726,13 @@ public class ForgeChunkManager
ModContainer container = getContainer(mod); ModContainer container = getContainer(mod);
if (container == null) if (container == null)
{ {
FMLLog.log(Level.ERROR, "Failed to locate the container for mod instance %s (%s : %x)", mod, mod.getClass().getName(), System.identityHashCode(mod)); FMLLog.log.error("Failed to locate the container for mod instance {} ({} : {})", mod, mod.getClass().getName(), Integer.toHexString(System.identityHashCode(mod)));
return null; return null;
} }
String modId = container.getModId(); String modId = container.getModId();
if (!callbacks.containsKey(modId)) if (!callbacks.containsKey(modId))
{ {
FMLLog.severe("The mod %s has attempted to request a ticket without a listener in place", modId); FMLLog.log.fatal("The mod {} has attempted to request a ticket without a listener in place", modId);
throw new RuntimeException("Invalid ticket request"); throw new RuntimeException("Invalid ticket request");
} }
@ -742,7 +742,7 @@ public class ForgeChunkManager
{ {
if (!warnedMods.contains(modId)) if (!warnedMods.contains(modId))
{ {
FMLLog.info("The mod %s has attempted to allocate a chunkloading ticket beyond it's currently allocated maximum : %d", modId, allowedCount); FMLLog.log.info("The mod {} has attempted to allocate a chunkloading ticket beyond it's currently allocated maximum: {}", modId, allowedCount);
warnedMods.add(modId); warnedMods.add(modId);
} }
return null; return null;
@ -806,7 +806,7 @@ public class ForgeChunkManager
} }
if (ticket.isPlayerTicket() ? !playerTickets.containsValue(ticket) : !tickets.get(ticket.world).containsEntry(ticket.modId, ticket)) if (ticket.isPlayerTicket() ? !playerTickets.containsValue(ticket) : !tickets.get(ticket.world).containsEntry(ticket.modId, ticket))
{ {
FMLLog.severe("The mod %s attempted to force load a chunk with an invalid ticket. This is not permitted.", ticket.modId); FMLLog.log.fatal("The mod {} attempted to force load a chunk with an invalid ticket. This is not permitted.", ticket.modId);
return; return;
} }
ticket.requestedChunks.add(chunk); ticket.requestedChunks.add(chunk);
@ -949,7 +949,7 @@ public class ForgeChunkManager
} }
catch (IOException e) catch (IOException e)
{ {
FMLLog.log(Level.WARN, e, "Unable to write forced chunk data to %s - chunkloading won't work", chunkLoaderData.getAbsolutePath()); FMLLog.log.warn("Unable to write forced chunk data to {} - chunkloading won't work", chunkLoaderData.getAbsolutePath(), e);
return; return;
} }
} }
@ -1015,7 +1015,7 @@ public class ForgeChunkManager
dest.delete(); dest.delete();
} }
cfgFile.renameTo(dest); cfgFile.renameTo(dest);
FMLLog.log(Level.ERROR, e, "A critical error occurred reading the forgeChunkLoading.cfg file, defaults will be used - the invalid file is backed up at forgeChunkLoading.cfg.bak"); FMLLog.log.error("A critical error occurred reading the forgeChunkLoading.cfg file, defaults will be used - the invalid file is backed up at forgeChunkLoading.cfg.bak", e);
} }
syncConfigDefaults(); syncConfigDefaults();
} }
@ -1068,7 +1068,7 @@ public class ForgeChunkManager
temp.setMinValue(0); temp.setMinValue(0);
dormantChunkCacheSize = temp.getInt(0); dormantChunkCacheSize = temp.getInt(0);
propOrder.add("dormantChunkCacheSize"); propOrder.add("dormantChunkCacheSize");
FMLLog.info("Configured a dormant chunk cache size of %d", temp.getInt(0)); FMLLog.log.info("Configured a dormant chunk cache size of {}", temp.getInt(0));
config.setCategoryPropertyOrder("defaults", propOrder); config.setCategoryPropertyOrder("defaults", propOrder);

View File

@ -42,6 +42,8 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import net.minecraft.crash.ICrashReportDetail; import net.minecraft.crash.ICrashReportDetail;
import net.minecraft.item.crafting.Ingredient; import net.minecraft.item.crafting.Ingredient;
@ -120,6 +122,8 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC
public static int dimensionUnloadQueueDelay = 0; public static int dimensionUnloadQueueDelay = 0;
public static boolean logCascadingWorldGeneration = true; // see Chunk#logCascadingWorldGeneration() public static boolean logCascadingWorldGeneration = true; // see Chunk#logCascadingWorldGeneration()
static final Logger log = LogManager.getLogger(ForgeVersion.MOD_ID);
private static Configuration config; private static Configuration config;
private static ForgeModContainer INSTANCE; private static ForgeModContainer INSTANCE;
public static ForgeModContainer getInstance() public static ForgeModContainer getInstance()
@ -233,7 +237,7 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC
if (removeErroringEntities) if (removeErroringEntities)
{ {
FMLLog.warning("Enabling removal of erroring Entities - USE AT YOUR OWN RISK"); FMLLog.log.warn("Enabling removal of erroring Entities - USE AT YOUR OWN RISK");
} }
prop = config.get(Configuration.CATEGORY_GENERAL, "removeErroringTileEntities", false); prop = config.get(Configuration.CATEGORY_GENERAL, "removeErroringTileEntities", false);
@ -244,7 +248,7 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC
if (removeErroringTileEntities) if (removeErroringTileEntities)
{ {
FMLLog.warning("Enabling removal of erroring Tile Entities - USE AT YOUR OWN RISK"); FMLLog.log.warn("Enabling removal of erroring Tile Entities - USE AT YOUR OWN RISK");
} }
prop = config.get(Configuration.CATEGORY_GENERAL, "fullBoundingBoxLadders", false); prop = config.get(Configuration.CATEGORY_GENERAL, "fullBoundingBoxLadders", false);
@ -420,11 +424,11 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC
itr.remove(); itr.remove();
} }
FMLLog.log(ForgeVersion.MOD_ID, Level.DEBUG, "Preloading CrashReport Classes"); log.debug("Preloading CrashReport Classes");
Collections.sort(all); //Sort it because I like pretty output ;) Collections.sort(all); //Sort it because I like pretty output ;)
for (String name : all) for (String name : all)
{ {
FMLLog.log(ForgeVersion.MOD_ID, Level.DEBUG, "\t" + name); log.debug("\t{}", name);
try try
{ {
Class.forName(name.replace('/', '.'), false, MinecraftForge.class.getClassLoader()); Class.forName(name.replace('/', '.'), false, MinecraftForge.class.getClassLoader());

View File

@ -37,6 +37,8 @@ import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import com.google.common.io.ByteStreams; import com.google.common.io.ByteStreams;
import com.google.gson.Gson; import com.google.gson.Gson;
@ -70,6 +72,8 @@ public class ForgeVersion
@SuppressWarnings("unused") @SuppressWarnings("unused")
private static String target = null; private static String target = null;
private static final Logger log = LogManager.getLogger("ForgeVersionCheck");
public static int getMajorVersion() public static int getMajorVersion()
{ {
return majorVersion; return majorVersion;
@ -186,7 +190,7 @@ public class ForgeVersion
{ {
if (!ForgeModContainer.getConfig().get(ForgeModContainer.VERSION_CHECK_CAT, "Global", true).getBoolean()) if (!ForgeModContainer.getConfig().get(ForgeModContainer.VERSION_CHECK_CAT, "Global", true).getBoolean())
{ {
FMLLog.log("ForgeVersionCheck", Level.INFO, "Global Forge version check system disabled, no further processing."); log.info("Global Forge version check system disabled, no further processing.");
return; return;
} }
@ -199,7 +203,7 @@ public class ForgeVersion
} }
else else
{ {
FMLLog.log("ForgeVersionCheck", Level.INFO, "[%s] Skipped version check", mod.getModId()); log.info("[{}] Skipped version check", mod.getModId());
} }
} }
} }
@ -208,7 +212,7 @@ public class ForgeVersion
{ {
try try
{ {
FMLLog.log("ForgeVersionCheck", Level.INFO, "[%s] Starting version check at %s", mod.getModId(), url.toString()); log.info("[{}] Starting version check at {}", mod.getModId(), url.toString());
Status status = PENDING; Status status = PENDING;
ComparableVersion target = null; ComparableVersion target = null;
@ -216,7 +220,7 @@ public class ForgeVersion
String data = new String(ByteStreams.toByteArray(con), "UTF-8"); String data = new String(ByteStreams.toByteArray(con), "UTF-8");
con.close(); con.close();
FMLLog.log("ForgeVersionCheck", Level.DEBUG, "[%s] Received version check data:\n%s", mod.getModId(), data); log.debug("[{}] Received version check data:\n{}", mod.getModId(), data);
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@ -269,7 +273,7 @@ public class ForgeVersion
else else
status = BETA; status = BETA;
FMLLog.log("ForgeVersionCheck", Level.INFO, "[%s] Found status: %s Target: %s", mod.getModId(), status, target); log.info("[{}] Found status: {} Target: {}", mod.getModId(), status, target);
Map<ComparableVersion, String> changes = new LinkedHashMap<ComparableVersion, String>(); Map<ComparableVersion, String> changes = new LinkedHashMap<ComparableVersion, String>();
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@ -298,7 +302,7 @@ public class ForgeVersion
} }
catch (Exception e) catch (Exception e)
{ {
FMLLog.log("ForgeVersionCheck", Level.DEBUG, e, "Failed to process update information"); log.debug("Failed to process update information", e);
status = FAILED; status = FAILED;
} }
} }

View File

@ -83,7 +83,7 @@ public class MinecraftForge
*/ */
public static void initialize() public static void initialize()
{ {
FMLLog.info("MinecraftForge v%s Initialized", ForgeVersion.getVersion()); FMLLog.log.info("MinecraftForge v{} Initialized", ForgeVersion.getVersion());
OreDictionary.getOreName(0); OreDictionary.getOreName(0);
@ -113,11 +113,11 @@ public class MinecraftForge
if (all.size() == 0) if (all.size() == 0)
return; return;
FMLLog.log(modID, Level.DEBUG, "Preloading CrashReport Classes"); ForgeModContainer.log.debug("Preloading CrashReport Classes");
Collections.sort(all); //Sort it because I like pretty output ;) Collections.sort(all); //Sort it because I like pretty output ;)
for (String name : all) for (String name : all)
{ {
FMLLog.log(modID, Level.DEBUG, "\t" + name); ForgeModContainer.log.debug("\t{}", name);
try try
{ {
Class.forName(name.replace('/', '.'), false, MinecraftForge.class.getClassLoader()); Class.forName(name.replace('/', '.'), false, MinecraftForge.class.getClassLoader());

View File

@ -95,7 +95,7 @@ public class WorldSpecificSaveHandler implements ISaveHandler
} }
catch (IOException e) catch (IOException e)
{ {
FMLLog.log(Level.ERROR, e, "A critical error occurred copying %s to world specific dat folder - new file will be created.", parentFile.getName()); FMLLog.log.error("A critical error occurred copying {} to world specific dat folder - new file will be created.", parentFile.getName(), e);
} }
} }
} }

View File

@ -115,7 +115,7 @@ public enum CapabilityManager
Type type = (Type)entry.getAnnotationInfo().get("value"); Type type = (Type)entry.getAnnotationInfo().get("value");
if (type == null) if (type == null)
{ {
FMLLog.log(Level.WARN, "Unable to inject capability at %s.%s (Invalid Annotation)", targetClass, targetName); FMLLog.log.warn("Unable to inject capability at {}.{} (Invalid Annotation)", targetClass, targetName);
continue; continue;
} }
final String capabilityName = type.getInternalName().replace('/', '.').intern(); final String capabilityName = type.getInternalName().replace('/', '.').intern();
@ -142,7 +142,7 @@ public enum CapabilityManager
{ {
if ((mtd.getModifiers() & Modifier.STATIC) != Modifier.STATIC) if ((mtd.getModifiers() & Modifier.STATIC) != Modifier.STATIC)
{ {
FMLLog.log(Level.WARN, "Unable to inject capability %s at %s.%s (Non-Static)", capabilityName, targetClass, targetName); FMLLog.log.warn("Unable to inject capability {} at {}.{} (Non-Static)", capabilityName, targetClass, targetName);
return null; return null;
} }
@ -151,11 +151,11 @@ public enum CapabilityManager
return null; return null;
} }
} }
FMLLog.log(Level.WARN, "Unable to inject capability %s at %s.%s (Method Not Found)", capabilityName, targetClass, targetName); FMLLog.log.warn("Unable to inject capability {} at {}.{} (Method Not Found)", capabilityName, targetClass, targetName);
} }
catch (Exception e) catch (Exception e)
{ {
FMLLog.log(Level.WARN, e, "Unable to inject capability %s at %s.%s", capabilityName, targetClass, targetName); FMLLog.log.warn("Unable to inject capability {} at {}.{}", capabilityName, targetClass, targetName, e);
} }
return null; return null;
} }
@ -173,14 +173,14 @@ public enum CapabilityManager
Field field = Class.forName(targetClass).getDeclaredField(targetName); Field field = Class.forName(targetClass).getDeclaredField(targetName);
if ((field.getModifiers() & Modifier.STATIC) != Modifier.STATIC) if ((field.getModifiers() & Modifier.STATIC) != Modifier.STATIC)
{ {
FMLLog.log(Level.WARN, "Unable to inject capability %s at %s.%s (Non-Static)", capabilityName, targetClass, targetName); FMLLog.log.warn("Unable to inject capability {} at {}.{} (Non-Static)", capabilityName, targetClass, targetName);
return null; return null;
} }
EnumHelper.setFailsafeFieldValue(field, null, input); EnumHelper.setFailsafeFieldValue(field, null, input);
} }
catch (Exception e) catch (Exception e)
{ {
FMLLog.log(Level.WARN, e, "Unable to inject capability %s at %s.%s", capabilityName, targetClass, targetName); FMLLog.log.warn("Unable to inject capability {} at {}.{}", capabilityName, targetClass, targetName, e);
} }
return null; return null;
} }

View File

@ -120,7 +120,7 @@ public class ChunkIOExecutor
ChunkIOProvider task = tasks.get(key); ChunkIOProvider task = tasks.get(key);
if (task == null) if (task == null)
{ {
FMLLog.warning("Attempted to dequeue chunk that wasn't queued? %d @ (%d, %d)", world.provider.getDimension(), x, z); FMLLog.log.warn("Attempted to dequeue chunk that wasn't queued? {} @ ({}, {})", world.provider.getDimension(), x, z);
return; return;
} }

View File

@ -104,7 +104,7 @@ public class ConfigManager
public static void loadData(ASMDataTable data) public static void loadData(ASMDataTable data)
{ {
FMLLog.fine("Loading @Config anotation data"); FMLLog.log.debug("Loading @Config anotation data");
for (ASMData target : data.getAll(Config.class.getName())) for (ASMData target : data.getAll(Config.class.getName()))
{ {
String modid = (String)target.getAnnotationInfo().get("modid"); String modid = (String)target.getAnnotationInfo().get("modid");
@ -150,7 +150,7 @@ public class ConfigManager
*/ */
public static void sync(String modid, Config.Type type) public static void sync(String modid, Config.Type type)
{ {
FMLLog.fine("Attempting to inject @Config classes into %s for type %s", modid, type); FMLLog.log.debug("Attempting to inject @Config classes into {} for type {}", modid, type);
ClassLoader mcl = Loader.instance().getModClassLoader(); ClassLoader mcl = Loader.instance().getModClassLoader();
File configDir = Loader.instance().getConfigDir(); File configDir = Loader.instance().getConfigDir();
Multimap<Config.Type, ASMData> map = asm_data.get(modid); Multimap<Config.Type, ASMData> map = asm_data.get(modid);
@ -194,7 +194,7 @@ public class ConfigManager
} }
catch (Exception e) catch (Exception e)
{ {
FMLLog.log(Level.ERROR, e, "An error occurred trying to load a config for %s into %s", modid, targ.getClassName()); FMLLog.log.error("An error occurred trying to load a config for {} into {}", targ.getClassName(), e);
throw new LoaderException(e); throw new LoaderException(e);
} }
} }

View File

@ -136,7 +136,7 @@ public class Configuration
{ {
File fileBak = new File(file.getAbsolutePath() + "_" + File fileBak = new File(file.getAbsolutePath() + "_" +
new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()) + ".errored"); new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()) + ".errored");
FMLLog.severe("An exception occurred while loading config file %s. This file will be renamed to %s " + FMLLog.log.fatal("An exception occurred while loading config file {}. This file will be renamed to {} " +
"and a new config file will be generated.", file.getName(), fileBak.getName()); "and a new config file will be generated.", file.getName(), fileBak.getName());
e.printStackTrace(); e.printStackTrace();

View File

@ -241,12 +241,12 @@ public final class AnimationStateMachine implements IAnimationStateMachine
} }
catch(IOException e) catch(IOException e)
{ {
FMLLog.log(Level.ERROR, e, "Exception loading Animation State Machine %s, skipping", location); FMLLog.log.error("Exception loading Animation State Machine {}, skipping", location, e);
return missing; return missing;
} }
catch(JsonParseException e) catch(JsonParseException e)
{ {
FMLLog.log(Level.ERROR, e, "Exception loading Animation State Machine %s, skipping", location); FMLLog.log.error("Exception loading Animation State Machine {}, skipping", location, e);
return missing; return missing;
} }
finally finally

View File

@ -100,7 +100,7 @@ public final class Clips
{ {
return new ModelClip(clip.get(), modelLocation, clipName); return new ModelClip(clip.get(), modelLocation, clipName);
} }
FMLLog.getLogger().error("Unable to find clip " + clipName + " in the model " + modelLocation); FMLLog.log.error("Unable to find clip {} in the model {}", clipName, modelLocation);
} }
// FIXME: missing clip? // FIXME: missing clip?
return new ModelClip(IdentityClip.INSTANCE, modelLocation, clipName); return new ModelClip(IdentityClip.INSTANCE, modelLocation, clipName);

View File

@ -39,7 +39,7 @@ public class DimensionMessageHandler extends SimpleChannelInboundHandler<ForgeMe
@Override @Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception
{ {
FMLLog.log(Level.ERROR, cause, "DimensionMessageHandler exception"); FMLLog.log.error("DimensionMessageHandler exception", cause);
super.exceptionCaught(ctx, cause); super.exceptionCaught(ctx, cause);
} }

View File

@ -36,7 +36,7 @@ public class FluidIdRegistryMessageHandler extends SimpleChannelInboundHandler<F
@Override @Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception
{ {
FMLLog.log(Level.ERROR, cause, "FluidIdRegistryMessageHandler exception"); FMLLog.log.error("FluidIdRegistryMessageHandler exception", cause);
super.exceptionCaught(ctx, cause); super.exceptionCaught(ctx, cause);
} }

View File

@ -110,7 +110,7 @@ public abstract class ForgeMessage {
} }
else else
{ {
FMLLog.getLogger().log(Level.INFO, "Legacy server message contains no default fluid list - there may be problems with fluids"); FMLLog.log.info("Legacy server message contains no default fluid list - there may be problems with fluids");
defaultFluids.clear(); defaultFluids.clear();
} }
} }

View File

@ -310,7 +310,7 @@ public class EnumHelper
} }
for (String line : lines) for (String line : lines)
FMLLog.severe(line); FMLLog.log.fatal(line);
if (test) if (test)
{ {

View File

@ -148,8 +148,8 @@ public class Fluid
} }
else else
{ {
FMLLog.warning("A mod has attempted to assign Block " + block + " to the Fluid '" + fluidName + "' but this Fluid has already been linked to the Block " FMLLog.log.warn("A mod has attempted to assign Block {} to the Fluid '{}' but this Fluid has already been linked to the Block {}. "
+ this.block + ". You may have duplicate Fluid Blocks as a result. It *may* be possible to configure your mods to avoid this."); + "You may have duplicate Fluid Blocks as a result. It *may* be possible to configure your mods to avoid this.", block, fluidName, this.block);
} }
return this; return this;
} }

View File

@ -123,13 +123,13 @@ public abstract class FluidRegistry
String derivedName = defaultName.split(":",2)[1]; String derivedName = defaultName.split(":",2)[1];
String localDefault = defaultFluidName.get(derivedName); String localDefault = defaultFluidName.get(derivedName);
if (localDefault == null) { if (localDefault == null) {
FMLLog.getLogger().log(Level.ERROR, "The fluid {} (specified as {}) is missing from this instance - it will be removed", derivedName, defaultName); FMLLog.log.error("The fluid {} (specified as {}) is missing from this instance - it will be removed", derivedName, defaultName);
continue; continue;
} }
fluid = masterFluidReference.get(localDefault); fluid = masterFluidReference.get(localDefault);
FMLLog.getLogger().log(Level.ERROR, "The fluid {} specified as default is not present - it will be reverted to default {}", defaultName, localDefault); FMLLog.log.error("The fluid {} specified as default is not present - it will be reverted to default {}", defaultName, localDefault);
} }
FMLLog.getLogger().log(Level.DEBUG, "The fluid {} has been selected as the default fluid for {}", defaultName, fluid.getName()); FMLLog.log.debug("The fluid {} has been selected as the default fluid for {}", defaultName, fluid.getName());
Fluid oldFluid = localFluids.put(fluid.getName(), fluid); Fluid oldFluid = localFluids.put(fluid.getName(), fluid);
Integer id = localFluidIDs.remove(oldFluid); Integer id = localFluidIDs.remove(oldFluid);
localFluidIDs.put(fluid, id); localFluidIDs.put(fluid, id);
@ -260,7 +260,7 @@ public abstract class FluidRegistry
{ {
ModContainer modContainer = Loader.instance().activeModContainer(); ModContainer modContainer = Loader.instance().activeModContainer();
String modContainerName = modContainer == null ? null : modContainer.getName(); String modContainerName = modContainer == null ? null : modContainer.getName();
FMLLog.getLogger().log(Level.ERROR, "Trying to activate the universal filled bucket too late. Call it statically in your Mods class. Mod: {}", modContainerName); FMLLog.log.error("Trying to activate the universal filled bucket too late. Call it statically in your Mods class. Mod: {}", modContainerName);
} }
else else
{ {
@ -350,7 +350,7 @@ public abstract class FluidRegistry
{ {
String name = masterFluidReference.inverse().get(key); String name = masterFluidReference.inverse().get(key);
if (Strings.isNullOrEmpty(name)) { if (Strings.isNullOrEmpty(name)) {
FMLLog.getLogger().log(Level.ERROR, "The fluid registry is corrupted. A fluid {} {} is not properly registered. The mod that registered this is broken", key.getClass().getName(), key.getName()); FMLLog.log.error("The fluid registry is corrupted. A fluid {} {} is not properly registered. The mod that registered this is broken", key.getClass().getName(), key.getName());
throw new IllegalStateException("The fluid registry is corrupted"); throw new IllegalStateException("The fluid registry is corrupted");
} }
return name; return name;
@ -361,7 +361,7 @@ public abstract class FluidRegistry
Set<String> defaults = Sets.newHashSet(); Set<String> defaults = Sets.newHashSet();
if (tag.hasKey("DefaultFluidList",9)) if (tag.hasKey("DefaultFluidList",9))
{ {
FMLLog.getLogger().log(Level.DEBUG, "Loading persistent fluid defaults from world"); FMLLog.log.debug("Loading persistent fluid defaults from world");
NBTTagList tl = tag.getTagList("DefaultFluidList", 8); NBTTagList tl = tag.getTagList("DefaultFluidList", 8);
for (int i = 0; i < tl.tagCount(); i++) for (int i = 0; i < tl.tagCount(); i++)
{ {
@ -370,7 +370,7 @@ public abstract class FluidRegistry
} }
else else
{ {
FMLLog.getLogger().log(Level.DEBUG, "World is missing persistent fluid defaults - using local defaults"); FMLLog.log.debug("World is missing persistent fluid defaults - using local defaults");
} }
loadFluidDefaults(HashBiMap.create(fluidIDs), defaults); loadFluidDefaults(HashBiMap.create(fluidIDs), defaults);
} }
@ -400,13 +400,13 @@ public abstract class FluidRegistry
if (!illegalFluids.isEmpty()) if (!illegalFluids.isEmpty())
{ {
FMLLog.getLogger().log(Level.FATAL, "The fluid registry is corrupted. Something has inserted a fluid without registering it"); FMLLog.log.fatal("The fluid registry is corrupted. Something has inserted a fluid without registering it");
FMLLog.getLogger().log(Level.FATAL, "There is {} unregistered fluids", illegalFluids.size()); FMLLog.log.fatal("There is {} unregistered fluids", illegalFluids.size());
for (Fluid f: illegalFluids) for (Fluid f: illegalFluids)
{ {
FMLLog.getLogger().log(Level.FATAL, " Fluid name : {}, type: {}", f.getName(), f.getClass().getName()); FMLLog.log.fatal(" Fluid name : {}, type: {}", f.getName(), f.getClass().getName());
} }
FMLLog.getLogger().log(Level.FATAL, "The mods that own these fluids need to register them properly"); FMLLog.log.fatal("The mods that own these fluids need to register them properly");
throw new IllegalStateException("The fluid map contains fluids unknown to the master fluid registry"); throw new IllegalStateException("The fluid map contains fluids unknown to the master fluid registry");
} }
} }

View File

@ -51,7 +51,7 @@ public class FluidStack
} }
else if (!FluidRegistry.isFluidRegistered(fluid)) else if (!FluidRegistry.isFluidRegistered(fluid))
{ {
FMLLog.bigWarning("Failed attempt to create a FluidStack for an unregistered Fluid %s (type %s)", fluid.getName(), fluid.getClass().getName()); FMLLog.bigWarning("Failed attempt to create a FluidStack for an unregistered Fluid {} (type {})", fluid.getName(), fluid.getClass().getName());
throw new IllegalArgumentException("Cannot create a fluidstack from an unregistered fluid"); throw new IllegalArgumentException("Cannot create a fluidstack from an unregistered fluid");
} }
this.fluidDelegate = FluidRegistry.makeDelegate(fluid); this.fluidDelegate = FluidRegistry.makeDelegate(fluid);

View File

@ -222,7 +222,7 @@ public class FMLClientHandler implements IFMLSidedHandler
this.resourcePackMap = Maps.newHashMap(); this.resourcePackMap = Maps.newHashMap();
if (minecraft.isDemo()) if (minecraft.isDemo())
{ {
FMLLog.severe("DEMO MODE DETECTED, FML will not work. Finishing now."); FMLLog.log.fatal("DEMO MODE DETECTED, FML will not work. Finishing now.");
haltGame("FML will not run in demo mode", new RuntimeException()); haltGame("FML will not run in demo mode", new RuntimeException());
return; return;
} }
@ -254,7 +254,7 @@ public class FMLClientHandler implements IFMLSidedHandler
} }
catch (CustomModLoadingErrorDisplayException custom) catch (CustomModLoadingErrorDisplayException custom)
{ {
FMLLog.log(Level.ERROR, custom, "A custom exception was thrown by a mod, the game will now halt"); FMLLog.log.error("A custom exception was thrown by a mod, the game will now halt", custom);
customError = custom; customError = custom;
} }
catch (MultipleModsErrored multiple) catch (MultipleModsErrored multiple)
@ -277,7 +277,7 @@ public class FMLClientHandler implements IFMLSidedHandler
} }
catch (CustomModLoadingErrorDisplayException custom) catch (CustomModLoadingErrorDisplayException custom)
{ {
FMLLog.log(Level.ERROR, custom, "A custom exception was thrown by a mod, the game will now halt"); FMLLog.log.error("A custom exception was thrown by a mod, the game will now halt", custom);
customError = custom; customError = custom;
} }
catch (LoaderException le) catch (LoaderException le)
@ -314,7 +314,7 @@ public class FMLClientHandler implements IFMLSidedHandler
{ {
ModMetadata optifineMetadata = MetadataCollection.from(optifineModInfoInputStream, "optifine").getMetadataForId("optifine", dummyOptifineMeta); ModMetadata optifineMetadata = MetadataCollection.from(optifineModInfoInputStream, "optifine").getMetadataForId("optifine", dummyOptifineMeta);
optifineContainer = new DummyModContainer(optifineMetadata); optifineContainer = new DummyModContainer(optifineMetadata);
FMLLog.info("Forge Mod Loader has detected optifine %s, enabling compatibility features", optifineContainer.getVersion()); FMLLog.log.info("Forge Mod Loader has detected optifine {}, enabling compatibility features", optifineContainer.getVersion());
} }
finally finally
{ {
@ -359,7 +359,7 @@ public class FMLClientHandler implements IFMLSidedHandler
} }
catch (CustomModLoadingErrorDisplayException custom) catch (CustomModLoadingErrorDisplayException custom)
{ {
FMLLog.log(Level.ERROR, custom, "A custom exception was thrown by a mod, the game will now halt"); FMLLog.log.error("A custom exception was thrown by a mod, the game will now halt", custom);
customError = custom; customError = custom;
SplashProgress.finish(); SplashProgress.finish();
return; return;
@ -394,7 +394,7 @@ public class FMLClientHandler implements IFMLSidedHandler
guiFactories.put(mc, guiFactory); guiFactories.put(mc, guiFactory);
} catch (Exception e) } catch (Exception e)
{ {
FMLLog.log(Level.ERROR, e, "A critical error occurred instantiating the gui factory for mod %s", mc.getModId()); FMLLog.log.error("A critical error occurred instantiating the gui factory for mod {}", mc.getModId(), e);
} }
} }
loading = false; loading = false;
@ -684,12 +684,12 @@ public class FMLClientHandler implements IFMLSidedHandler
} }
catch (NoSuchMethodException e) catch (NoSuchMethodException e)
{ {
FMLLog.log(Level.ERROR, "The container %s (type %s) returned an invalid class for it's resource pack.", container.getName(), container.getClass().getName()); FMLLog.log.error("The container {} (type {}) returned an invalid class for it's resource pack.", container.getName(), container.getClass().getName());
return; return;
} }
catch (Exception e) catch (Exception e)
{ {
FMLLog.log(Level.ERROR, e, "An unexpected exception occurred constructing the custom resource pack for %s", container.getName()); FMLLog.log.error("An unexpected exception occurred constructing the custom resource pack for {}", container.getName(), e);
throw Throwables.propagate(e); throw Throwables.propagate(e);
} }
} }
@ -763,7 +763,7 @@ public class FMLClientHandler implements IFMLSidedHandler
} }
catch (Exception e1) catch (Exception e1)
{ {
FMLLog.warning("There appears to be a problem loading the save %s, both level files are unreadable.", comparator.getFileName()); FMLLog.log.warn("There appears to be a problem loading the save {}, both level files are unreadable.", comparator.getFileName());
return; return;
} }
} }

View File

@ -25,6 +25,7 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
@ -61,7 +62,7 @@ public class FMLFileResourcePack extends FileResourcePack implements FMLContaine
{ {
if ("pack.mcmeta".equals(resourceName)) if ("pack.mcmeta".equals(resourceName))
{ {
FMLLog.log(container.getName(), Level.DEBUG, "Mod %s is missing a pack.mcmeta file, substituting a dummy one", container.getName()); LogManager.getLogger(container.getName()).debug("Mod {} is missing a pack.mcmeta file, substituting a dummy one", container.getName());
return new ByteArrayInputStream(("{\n" + return new ByteArrayInputStream(("{\n" +
" \"pack\": {\n"+ " \"pack\": {\n"+
" \"description\": \"dummy FML pack for "+container.getName()+"\",\n"+ " \"description\": \"dummy FML pack for "+container.getName()+"\",\n"+

View File

@ -25,6 +25,7 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
@ -66,7 +67,7 @@ public class FMLFolderResourcePack extends FolderResourcePack implements FMLCont
{ {
if ("pack.mcmeta".equals(resourceName)) if ("pack.mcmeta".equals(resourceName))
{ {
FMLLog.log(container.getName(), Level.DEBUG, "Mod %s is missing a pack.mcmeta file, substituting a dummy one", container.getName()); LogManager.getLogger(container.getName()).debug("Mod {} is missing a pack.mcmeta file, substituting a dummy one", container.getName());
return new ByteArrayInputStream(("{\n" + return new ByteArrayInputStream(("{\n" +
" \"pack\": {\n"+ " \"pack\": {\n"+
" \"description\": \"dummy FML pack for "+container.getName()+"\",\n"+ " \"description\": \"dummy FML pack for "+container.getName()+"\",\n"+

View File

@ -65,7 +65,7 @@ public class GuiErrorBase extends GuiErrorScreen
} }
catch (Exception e) catch (Exception e)
{ {
FMLLog.log(Level.ERROR, e, "Problem opening mods folder"); FMLLog.log.error("Problem opening mods folder", e);
} }
} }
else if (button.id == 11) else if (button.id == 11)
@ -76,7 +76,7 @@ public class GuiErrorBase extends GuiErrorScreen
} }
catch (Exception e) catch (Exception e)
{ {
FMLLog.log(Level.ERROR, e, "Problem opening log file " + clientLog); FMLLog.log.error("Problem opening log file {}", clientLog, e);
} }
} }
} }

View File

@ -71,7 +71,7 @@ public class GuiJava8Error extends GuiErrorBase
} }
catch (Exception e) catch (Exception e)
{ {
FMLLog.log(Level.ERROR, e, "Problem launching browser"); FMLLog.log.error("Problem launching browser", e);
} }
} }
else else

View File

@ -295,7 +295,7 @@ public class GuiModList extends GuiScreen
} }
catch (Exception e) catch (Exception e)
{ {
FMLLog.log(Level.ERROR, e, "There was a critical issue trying to build the config GUI for %s", selectedMod.getModId()); FMLLog.log.error("There was a critical issue trying to build the config GUI for {}", selectedMod.getModId(), e);
} }
return; return;
} }

View File

@ -78,7 +78,7 @@ public class GuiOldSaveLoadConfirm extends GuiYesNo implements GuiYesNoCallback
} }
else else
{ {
FMLLog.info("Capturing current state of world %s into file %s", saveName, zip.getAbsolutePath()); FMLLog.log.info("Capturing current state of world {} into file {}", saveName, zip.getAbsolutePath());
try try
{ {
String skip = System.getProperty("fml.doNotBackup"); String skip = System.getProperty("fml.doNotBackup");
@ -89,11 +89,11 @@ public class GuiOldSaveLoadConfirm extends GuiYesNo implements GuiYesNoCallback
else else
{ {
for (int x = 0; x < 10; x++) for (int x = 0; x < 10; x++)
FMLLog.severe("!!!!!!!!!! UPDATING WORLD WITHOUT DOING BACKUP !!!!!!!!!!!!!!!!"); FMLLog.log.fatal("!!!!!!!!!! UPDATING WORLD WITHOUT DOING BACKUP !!!!!!!!!!!!!!!!");
} }
} catch (IOException e) } catch (IOException e)
{ {
FMLLog.log(Level.WARN, e, "There was a problem saving the backup %s. Please fix and try again", zip.getName()); FMLLog.log.warn("There was a problem saving the backup {}. Please fix and try again", zip.getName(), e);
FMLClientHandler.instance().showGuiScreen(new GuiBackupFailed(parent, zip)); FMLClientHandler.instance().showGuiScreen(new GuiBackupFailed(parent, zip));
return; return;
} }

View File

@ -160,7 +160,7 @@ public class SplashProgress
} }
catch(IOException e) catch(IOException e)
{ {
FMLLog.info("Could not load splash.properties, will create a default one"); FMLLog.log.info("Could not load splash.properties, will create a default one");
} }
finally finally
{ {
@ -202,7 +202,7 @@ public class SplashProgress
} }
catch(IOException e) catch(IOException e)
{ {
FMLLog.log(Level.ERROR, e, "Could not save the splash.properties file"); FMLLog.log.error("Could not save the splash.properties file", e);
} }
finally finally
{ {
@ -233,7 +233,7 @@ public class SplashProgress
CrashReport report = CrashReport.makeCrashReport(new Throwable(), "Loading screen debug info"); CrashReport report = CrashReport.makeCrashReport(new Throwable(), "Loading screen debug info");
StringBuilder systemDetailsBuilder = new StringBuilder(); StringBuilder systemDetailsBuilder = new StringBuilder();
report.getCategory().appendToStringBuilder(systemDetailsBuilder); report.getCategory().appendToStringBuilder(systemDetailsBuilder);
FMLLog.info(systemDetailsBuilder.toString()); FMLLog.log.info(systemDetailsBuilder.toString());
try try
{ {
@ -401,13 +401,13 @@ public class SplashProgress
if (!isDisplayVSyncForced) if (!isDisplayVSyncForced)
{ {
isDisplayVSyncForced = true; isDisplayVSyncForced = true;
FMLLog.log(Level.INFO, "Using alternative sync timing : %d frames of Display.update took %d nanos", TIMING_FRAME_COUNT, updateTiming); FMLLog.log.info("Using alternative sync timing : {} frames of Display.update took {} nanos", TIMING_FRAME_COUNT, updateTiming);
} }
try { Thread.sleep(16); } catch (InterruptedException ie) {} try { Thread.sleep(16); } catch (InterruptedException ie) {}
} else } else
{ {
if (framecount ==TIMING_FRAME_COUNT) { if (framecount ==TIMING_FRAME_COUNT) {
FMLLog.log(Level.INFO, "Using sync timing. %d frames of Display.update took %d nanos", TIMING_FRAME_COUNT, updateTiming); FMLLog.log.info("Using sync timing. {} frames of Display.update took {} nanos", TIMING_FRAME_COUNT, updateTiming);
} }
Display.sync(100); Display.sync(100);
} }
@ -581,7 +581,7 @@ public class SplashProgress
@Override @Override
public void uncaughtException(Thread t, Throwable e) public void uncaughtException(Thread t, Throwable e)
{ {
FMLLog.log(Level.ERROR, e, "Splash thread Exception"); FMLLog.log.error("Splash thread Exception", e);
threadError = e; threadError = e;
} }
}); });
@ -730,7 +730,7 @@ public class SplashProgress
} }
catch(IOException e) catch(IOException e)
{ {
FMLLog.log(Level.ERROR, e, "Could not save the splash.properties file"); FMLLog.log.error("Could not save the splash.properties file", e);
return false; return false;
} }
finally finally

View File

@ -128,7 +128,7 @@ public class GuiConfigEntries extends GuiListExtended
} }
catch (Throwable e) catch (Throwable e)
{ {
FMLLog.severe("There was a critical error instantiating the custom IConfigEntry for config element %s.", configElement.getName()); FMLLog.log.fatal("There was a critical error instantiating the custom IConfigEntry for config element {}.", configElement.getName());
e.printStackTrace(); e.printStackTrace();
} }
else if (configElement.isProperty()) else if (configElement.isProperty())

View File

@ -81,7 +81,7 @@ public class GuiEditArrayEntries extends GuiListExtended
} }
catch (Throwable e) catch (Throwable e)
{ {
FMLLog.log(Level.ERROR, e, "There was a critical error instantiating the custom IGuiEditListEntry for property %s.", configElement.getName()); FMLLog.log.error("There was a critical error instantiating the custom IGuiEditListEntry for property {}.", configElement.getName(), e);
} }
} }
} }
@ -156,7 +156,7 @@ public class GuiEditArrayEntries extends GuiListExtended
} }
catch (Throwable e) catch (Throwable e)
{ {
FMLLog.log(Level.ERROR, e, "There was a critical error instantiating the custom IGuiEditListEntry for property %s.", configElement.getName()); FMLLog.log.error("There was a critical error instantiating the custom IGuiEditListEntry for property {}.", configElement.getName(), e);
} }
} }
else if (configElement.isList() && configElement.getType() == ConfigGuiType.BOOLEAN) else if (configElement.isList() && configElement.getType() == ConfigGuiType.BOOLEAN)

View File

@ -45,7 +45,7 @@ public class AutomaticEventSubscriber
private static final EnumSet<Side> DEFAULT = EnumSet.allOf(Side.class); private static final EnumSet<Side> DEFAULT = EnumSet.allOf(Side.class);
public static void inject(ModContainer mod, ASMDataTable data, Side side) public static void inject(ModContainer mod, ASMDataTable data, Side side)
{ {
FMLLog.fine("Attempting to inject @EventBusSubscriber classes into the eventbus for %s", mod.getModId()); FMLLog.log.debug("Attempting to inject @EventBusSubscriber classes into the eventbus for {}", mod.getModId());
SetMultimap<String, ASMData> modData = data.getAnnotationsFor(mod); SetMultimap<String, ASMData> modData = data.getAnnotationsFor(mod);
Set<ASMDataTable.ASMData> mods = modData.get(Mod.class.getName()); Set<ASMDataTable.ASMData> mods = modData.get(Mod.class.getName());
Set<ASMDataTable.ASMData> targets = modData.get(Mod.EventBusSubscriber.class.getName()); Set<ASMDataTable.ASMData> targets = modData.get(Mod.EventBusSubscriber.class.getName());
@ -65,28 +65,28 @@ public class AutomaticEventSubscriber
} }
} }
if (sides == DEFAULT || sides.contains(side)) { if (sides == DEFAULT || sides.contains(side)) {
FMLLog.fine("Found @EventBusSubscriber class %s", targ.getClassName()); FMLLog.log.debug("Found @EventBusSubscriber class {}", targ.getClassName());
String amodid = (String)targ.getAnnotationInfo().get("modid"); String amodid = (String)targ.getAnnotationInfo().get("modid");
if (Strings.isNullOrEmpty(amodid)) { if (Strings.isNullOrEmpty(amodid)) {
amodid = ASMDataTable.getOwnerModID(mods, targ); amodid = ASMDataTable.getOwnerModID(mods, targ);
if (Strings.isNullOrEmpty(amodid)) { if (Strings.isNullOrEmpty(amodid)) {
FMLLog.bigWarning("Could not determine owning mod for @EventBusSubscriber on %s for mod %s", targ.getClassName(), mod.getModId()); FMLLog.bigWarning("Could not determine owning mod for @EventBusSubscriber on {} for mod {}", targ.getClassName(), mod.getModId());
continue; continue;
} }
} }
if (!mod.getModId().equals(amodid)) if (!mod.getModId().equals(amodid))
{ {
FMLLog.fine("Skipping @EventBusSubscriber injection for %s since it is not for mod %s", targ.getClassName(), mod.getModId()); FMLLog.log.debug("Skipping @EventBusSubscriber injection for {} since it is not for mod {}", targ.getClassName(), mod.getModId());
continue; //We're not injecting this guy continue; //We're not injecting this guy
} }
Class<?> subscriptionTarget = Class.forName(targ.getClassName(), true, mcl); Class<?> subscriptionTarget = Class.forName(targ.getClassName(), true, mcl);
MinecraftForge.EVENT_BUS.register(subscriptionTarget); MinecraftForge.EVENT_BUS.register(subscriptionTarget);
FMLLog.fine("Injected @EventBusSubscriber class %s", targ.getClassName()); FMLLog.log.debug("Injected @EventBusSubscriber class {}", targ.getClassName());
} }
} }
catch (Exception e) catch (Exception e)
{ {
FMLLog.log(Level.ERROR, e, "An error occurred trying to load an EventBusSubscriber %s for modid %s", targ.getClassName(), mod.getModId()); FMLLog.log.error("An error occurred trying to load an EventBusSubscriber {} for modid {}", mod.getModId(), e);
throw new LoaderException(e); throw new LoaderException(e);
} }
} }

View File

@ -59,6 +59,7 @@ import net.minecraftforge.common.ForgeVersion;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.crafting.CraftingHelper; import net.minecraftforge.common.crafting.CraftingHelper;
import net.minecraftforge.common.util.CompoundDataFixer; import net.minecraftforge.common.util.CompoundDataFixer;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.eventhandler.EventBus; import net.minecraftforge.fml.common.eventhandler.EventBus;
import net.minecraftforge.fml.common.gameevent.InputEvent; import net.minecraftforge.fml.common.gameevent.InputEvent;
import net.minecraftforge.fml.common.gameevent.PlayerEvent; import net.minecraftforge.fml.common.gameevent.PlayerEvent;
@ -188,10 +189,13 @@ public class FMLCommonHandler
/** /**
* Get the forge mod loader logging instance (goes to the forgemodloader log file) * Get the forge mod loader logging instance (goes to the forgemodloader log file)
* @return The log instance for the FML log file * @return The log instance for the FML log file
*
* @deprecated Not used in FML, Mods use your own logger, see {@link FMLPreInitializationEvent#getModLog()}
*/ */
@Deprecated
public Logger getFMLLogger() public Logger getFMLLogger()
{ {
return FMLLog.getLogger(); return FMLLog.log;
} }
public Side getSide() public Side getSide()
@ -214,7 +218,7 @@ public class FMLCommonHandler
*/ */
public void raiseException(Throwable exception, String message, boolean stopGame) public void raiseException(Throwable exception, String message, boolean stopGame)
{ {
FMLLog.log(Level.ERROR, exception, "Something raised an exception. The message was '%s'. 'stopGame' is %b", message, stopGame); FMLLog.log.error("Something raised an exception. The message was '{}'. 'stopGame' is {}", stopGame, exception);
if (stopGame) if (stopGame)
{ {
getSidedDelegate().haltGame(message,exception); getSidedDelegate().haltGame(message,exception);
@ -480,19 +484,19 @@ public class FMLCommonHandler
{ {
try try
{ {
FMLLog.info("Waiting for the server to terminate/save."); FMLLog.log.info("Waiting for the server to terminate/save.");
if (!latch.await(10, TimeUnit.SECONDS)) if (!latch.await(10, TimeUnit.SECONDS))
{ {
FMLLog.warning("The server didn't stop within 10 seconds, exiting anyway."); FMLLog.log.warn("The server didn't stop within 10 seconds, exiting anyway.");
} }
else else
{ {
FMLLog.info("Server terminated."); FMLLog.log.info("Server terminated.");
} }
} }
catch (InterruptedException e) catch (InterruptedException e)
{ {
FMLLog.warning("Interrupted wait, exiting."); FMLLog.log.warn("Interrupted wait, exiting.");
} }
} }
@ -626,7 +630,7 @@ public class FMLCommonHandler
if (!shouldAllowPlayerLogins()) if (!shouldAllowPlayerLogins())
{ {
TextComponentString text = new TextComponentString("Server is still starting! Please wait before reconnecting."); TextComponentString text = new TextComponentString("Server is still starting! Please wait before reconnecting.");
FMLLog.info("Disconnecting Player: " + text.getUnformattedText()); FMLLog.log.info("Disconnecting Player: {}", text.getUnformattedText());
manager.sendPacket(new SPacketDisconnect(text)); manager.sendPacket(new SPacketDisconnect(text));
manager.closeChannel(text); manager.closeChannel(text);
return false; return false;
@ -636,7 +640,7 @@ public class FMLCommonHandler
{ {
manager.setConnectionState(EnumConnectionState.LOGIN); manager.setConnectionState(EnumConnectionState.LOGIN);
TextComponentString text = new TextComponentString("This server requires FML/Forge to be installed. Contact your server admin for more details."); TextComponentString text = new TextComponentString("This server requires FML/Forge to be installed. Contact your server admin for more details.");
FMLLog.info("Disconnecting Player: " + text.getUnformattedText()); FMLLog.log.info("Disconnecting Player: {}", text.getUnformattedText());
manager.sendPacket(new SPacketDisconnect(text)); manager.sendPacket(new SPacketDisconnect(text));
manager.closeChannel(text); manager.closeChannel(text);
return false; return false;
@ -661,18 +665,18 @@ public class FMLCommonHandler
*/ */
public void exitJava(int exitCode, boolean hardExit) public void exitJava(int exitCode, boolean hardExit)
{ {
FMLLog.log(Level.INFO, "Java has been asked to exit (code %d) by %s.", exitCode, Thread.currentThread().getStackTrace()[1]); FMLLog.log.info("Java has been asked to exit (code {}) by {}.", exitCode, Thread.currentThread().getStackTrace()[1]);
if (hardExit) if (hardExit)
{ {
FMLLog.log(Level.INFO, "This is an abortive exit and could cause world corruption or other things"); FMLLog.log.info("This is an abortive exit and could cause world corruption or other things");
} }
if (Boolean.parseBoolean(System.getProperty("fml.debugExit", "false"))) if (Boolean.parseBoolean(System.getProperty("fml.debugExit", "false")))
{ {
FMLLog.log(Level.INFO, new Throwable(), "Exit trace"); FMLLog.log.info("Exit trace", new Throwable());
} }
else else
{ {
FMLLog.log(Level.INFO, "If this was an unexpected exit, use -Dfml.debugExit=true as a JVM argument to find out where it was called"); FMLLog.log.info("If this was an unexpected exit, use -Dfml.debugExit=true as a JVM argument to find out where it was called");
} }
if (hardExit) if (hardExit)
{ {
@ -698,11 +702,11 @@ public class FMLCommonHandler
} }
catch (InterruptedException e) catch (InterruptedException e)
{ {
FMLLog.log(Level.FATAL, e, "Exception caught executing FutureTask: " + e.toString()); FMLLog.log.fatal("Exception caught executing FutureTask: {}", e.toString(), e);
} }
catch (ExecutionException e) catch (ExecutionException e)
{ {
FMLLog.log(Level.FATAL, e, "Exception caught executing FutureTask: " + e.toString()); FMLLog.log.fatal("Exception caught executing FutureTask: {}", e.toString(), e);
} }
} }

View File

@ -48,6 +48,7 @@ import net.minecraftforge.fml.common.registry.VillagerRegistry;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import com.google.common.eventbus.EventBus; import com.google.common.eventbus.EventBus;
import com.google.common.eventbus.Subscribe; import com.google.common.eventbus.Subscribe;
@ -120,7 +121,7 @@ public final class FMLContainer extends DummyModContainer implements WorldAccess
NBTTagCompound registries = new NBTTagCompound(); NBTTagCompound registries = new NBTTagCompound();
fmlData.setTag("Registries", registries); fmlData.setTag("Registries", registries);
FMLLog.fine("Gathering id map for writing to world save %s", info.getWorldName()); FMLLog.log.debug("Gathering id map for writing to world save {}", info.getWorldName());
PersistentRegistryManager.GameDataSnapshot dataSnapshot = PersistentRegistryManager.takeSnapshot(); PersistentRegistryManager.GameDataSnapshot dataSnapshot = PersistentRegistryManager.takeSnapshot();
for (Map.Entry<ResourceLocation, PersistentRegistryManager.GameDataSnapshot.Entry> e : dataSnapshot.entries.entrySet()) for (Map.Entry<ResourceLocation, PersistentRegistryManager.GameDataSnapshot.Entry> e : dataSnapshot.entries.entrySet())
@ -193,12 +194,12 @@ public final class FMLContainer extends DummyModContainer implements WorldAccess
ModContainer container = Loader.instance().getIndexedModList().get(modId); ModContainer container = Loader.instance().getIndexedModList().get(modId);
if (container == null) if (container == null)
{ {
FMLLog.log("fml.ModTracker", Level.ERROR, "This world was saved with mod %s which appears to be missing, things may not work well", modId); LogManager.getLogger("fml.ModTracker").error("This world was saved with mod {} which appears to be missing, things may not work well", modId);
continue; continue;
} }
if (!modVersion.equals(container.getVersion())) if (!modVersion.equals(container.getVersion()))
{ {
FMLLog.log("fml.ModTracker", Level.INFO, "This world was saved with mod %s version %s and it is now at version %s, things may not work well", modId, modVersion, container.getVersion()); LogManager.getLogger("fml.ModTracker").info("This world was saved with mod {} version {} and it is now at version {}, things may not work well", modId, modVersion, container.getVersion());
} }
} }
} }

View File

@ -19,73 +19,107 @@
package net.minecraftforge.fml.common; package net.minecraftforge.fml.common;
import org.apache.logging.log4j.Level; import java.util.Locale;
import org.apache.logging.log4j.Logger;
@SuppressWarnings("static-access") import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.relauncher.FMLLaunchHandler;
import net.minecraftforge.fml.relauncher.FMLRelaunchLog;
import net.minecraftforge.fml.relauncher.Side;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.ThreadContext;
/**
* FMLs logging class. <b>Internal use only, NOT FOR MOD LOGGING!</b> Mods use your own log, see {@link FMLPreInitializationEvent#getModLog()}.
*/
public class FMLLog public class FMLLog
{ {
private static net.minecraftforge.fml.relauncher.FMLRelaunchLog coreLog = net.minecraftforge.fml.relauncher.FMLRelaunchLog.log;
public static void log(String targetLog, Level level, String format, Object... data) public static final Logger log;
{
coreLog.log(targetLog, level, format, data);
}
public static void log(Level level, String format, Object... data) static {
{ log = LogManager.getLogger("FML");
coreLog.log(level, format, data); // Default side to client for test harness purposes
} Side side = FMLLaunchHandler.side();
if (side == null) side = Side.CLIENT;
ThreadContext.put("side", side.name().toLowerCase(Locale.ENGLISH));
public static void log(String targetLog, Level level, Throwable ex, String format, Object... data) log.debug("Injecting tracing printstreams for STDOUT/STDERR.");
{ System.setOut(new TracingPrintStream(LogManager.getLogger("STDOUT"), System.out));
coreLog.log(targetLog, level, ex, format, data); System.setErr(new TracingPrintStream(LogManager.getLogger("STDERR"), System.err));
}
public static void log(Level level, Throwable ex, String format, Object... data)
{
coreLog.log(level, ex, format, data);
}
public static void severe(String format, Object... data)
{
log(Level.ERROR, format, data);
} }
public static void bigWarning(String format, Object... data) public static void bigWarning(String format, Object... data)
{ {
StackTraceElement[] trace = Thread.currentThread().getStackTrace(); StackTraceElement[] trace = Thread.currentThread().getStackTrace();
log(Level.WARN, "****************************************"); log.warn("****************************************");
log(Level.WARN, "* "+format, data); log.warn("* "+format, data);
for (int i = 2; i < 8 && i < trace.length; i++) for (int i = 2; i < 8 && i < trace.length; i++)
{ {
log(Level.WARN, "* at %s%s", trace[i].toString(), i == 7 ? "..." : ""); log.warn("* at {}{}", trace[i].toString(), i == 7 ? "..." : "");
} }
log(Level.WARN, "****************************************"); log.warn("****************************************");
} }
@Deprecated
public static void log(String targetLog, Level level, String format, Object... data)
{
FMLRelaunchLog.log(targetLog, level, format, data);
}
@Deprecated
public static void log(Level level, String format, Object... data)
{
FMLRelaunchLog.log(level, format, data);
}
@Deprecated
public static void log(String targetLog, Level level, Throwable ex, String format, Object... data)
{
FMLRelaunchLog.log(targetLog, level, ex, format, data);
}
@Deprecated
public static void log(Level level, Throwable ex, String format, Object... data)
{
FMLRelaunchLog.log(level, ex, format, data);
}
@Deprecated
public static void severe(String format, Object... data)
{
log(Level.ERROR, format, data);
}
@Deprecated
public static void warning(String format, Object... data) public static void warning(String format, Object... data)
{ {
log(Level.WARN, format, data); log(Level.WARN, format, data);
} }
@Deprecated
public static void info(String format, Object... data) public static void info(String format, Object... data)
{ {
log(Level.INFO, format, data); log(Level.INFO, format, data);
} }
@Deprecated
public static void fine(String format, Object... data) public static void fine(String format, Object... data)
{ {
log(Level.DEBUG, format, data); log(Level.DEBUG, format, data);
} }
@Deprecated
public static void finer(String format, Object... data) public static void finer(String format, Object... data)
{ {
log(Level.TRACE, format, data); log(Level.TRACE, format, data);
} }
@Deprecated
public static Logger getLogger() public static Logger getLogger()
{ {
return coreLog.getLogger(); return log;
} }
} }

View File

@ -57,6 +57,8 @@ import net.minecraftforge.fml.relauncher.Side;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipFile; import java.util.zip.ZipFile;
@ -107,6 +109,8 @@ public class FMLModContainer implements ModContainer
private URL updateJSONUrl; private URL updateJSONUrl;
private int classVersion; private int classVersion;
private final Logger modLog;
public FMLModContainer(String className, ModCandidate container, Map<String, Object> modDescriptor) public FMLModContainer(String className, ModCandidate container, Map<String, Object> modDescriptor)
{ {
this.className = className; this.className = className;
@ -125,9 +129,11 @@ public class FMLModContainer implements ModContainer
{ {
// Delay loading of the adapter until the mod is on the classpath, in case the mod itself contains it. // Delay loading of the adapter until the mod is on the classpath, in case the mod itself contains it.
this.languageAdapter = null; this.languageAdapter = null;
FMLLog.finer("Using custom language adapter %s for %s (modid: %s)", languageAdapterType, this.className, getModId()); FMLLog.log.trace("Using custom language adapter {} for {} (modid: {})", languageAdapterType, this.className, getModId());
} }
sanityCheckModId(); sanityCheckModId();
modLog = LogManager.getLogger(getModId());
} }
private void sanityCheckModId() private void sanityCheckModId()
@ -139,12 +145,12 @@ public class FMLModContainer implements ModContainer
} }
if (modid.length() > 64) if (modid.length() > 64)
{ {
FMLLog.bigWarning("The modid %s is longer than the recommended maximum of 64 characters. Truncation is enforced in 1.11", modid); FMLLog.bigWarning("The modid {} is longer than the recommended maximum of 64 characters. Truncation is enforced in 1.11", modid);
throw new IllegalArgumentException(String.format("The modid %s is longer than the recommended maximum of 64 characters. Truncation is enforced in 1.11", modid)); throw new IllegalArgumentException(String.format("The modid %s is longer than the recommended maximum of 64 characters. Truncation is enforced in 1.11", modid));
} }
if (!modid.equals(modid.toLowerCase(Locale.ENGLISH))) if (!modid.equals(modid.toLowerCase(Locale.ENGLISH)))
{ {
FMLLog.bigWarning("The modid %s is not the same as it's lowercase version. Lowercasing is enforced in 1.11", modid); FMLLog.bigWarning("The modid {} is not the same as it's lowercase version. Lowercasing is enforced in 1.11", modid);
throw new IllegalArgumentException(String.format("The modid %s is not the same as it's lowercase version. Lowercasing will be enforced in 1.11", modid)); throw new IllegalArgumentException(String.format("The modid %s is not the same as it's lowercase version. Lowercasing will be enforced in 1.11", modid));
} }
} }
@ -158,7 +164,7 @@ public class FMLModContainer implements ModContainer
} }
catch (Exception ex) catch (Exception ex)
{ {
FMLLog.log(Level.ERROR, ex, "Error constructing custom mod language adapter referenced by %s (modid: %s)", this.className, getModId()); FMLLog.log.error("Error constructing custom mod language adapter referenced by {} (modid: {})", getModId(), ex);
throw new RuntimeException(ex); throw new RuntimeException(ex);
} }
} }
@ -217,15 +223,15 @@ public class FMLModContainer implements ModContainer
modMetadata.requiredMods = requirements; modMetadata.requiredMods = requirements;
modMetadata.dependencies = dependencies; modMetadata.dependencies = dependencies;
modMetadata.dependants = dependants; modMetadata.dependants = dependants;
FMLLog.log(getModId(), Level.TRACE, "Parsed dependency info : %s %s %s", requirements, dependencies, dependants); modLog.trace("Parsed dependency info : {} {} {}", requirements, dependencies, dependants);
} }
else else
{ {
FMLLog.log(getModId(), Level.TRACE, "Using mcmod dependency info : %s %s %s", modMetadata.requiredMods, modMetadata.dependencies, modMetadata.dependants); modLog.trace("Using mcmod dependency info : {} {} {}", modMetadata.requiredMods, modMetadata.dependencies, modMetadata.dependants);
} }
if (Strings.isNullOrEmpty(modMetadata.name)) if (Strings.isNullOrEmpty(modMetadata.name))
{ {
FMLLog.log(getModId(), Level.INFO, "Mod %s is missing the required element 'name'. Substituting %s", getModId(), getModId()); modLog.info("Mod {} is missing the required element 'name'. Substituting {}", getModId(), getModId());
modMetadata.name = getModId(); modMetadata.name = getModId();
} }
internalVersion = (String)descriptor.get("version"); internalVersion = (String)descriptor.get("version");
@ -235,18 +241,18 @@ public class FMLModContainer implements ModContainer
if (versionProps != null) if (versionProps != null)
{ {
internalVersion = versionProps.getProperty(getModId() + ".version"); internalVersion = versionProps.getProperty(getModId() + ".version");
FMLLog.log(getModId(), Level.DEBUG, "Found version %s for mod %s in version.properties, using", internalVersion, getModId()); modLog.debug("Found version {} for mod {} in version.properties, using", internalVersion, getModId());
} }
} }
if (Strings.isNullOrEmpty(internalVersion) && !Strings.isNullOrEmpty(modMetadata.version)) if (Strings.isNullOrEmpty(internalVersion) && !Strings.isNullOrEmpty(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); modLog.warn("Mod {} is missing the required element 'version' and a version.properties file could not be found. Falling back to metadata version {}", getModId(), modMetadata.version);
internalVersion = modMetadata.version; internalVersion = modMetadata.version;
} }
if (Strings.isNullOrEmpty(internalVersion)) if (Strings.isNullOrEmpty(internalVersion))
{ {
FMLLog.log(getModId(), Level.WARN, "Mod %s is missing the required element 'version' and no fallback can be found. Substituting '1.0'.", getModId()); modLog.warn("Mod {} is missing the required element 'version' and no fallback can be found. Substituting '1.0'.", getModId());
modMetadata.version = internalVersion = "1.0"; modMetadata.version = internalVersion = "1.0";
} }
@ -277,7 +283,7 @@ public class FMLModContainer implements ModContainer
} }
catch (MalformedURLException e) catch (MalformedURLException e)
{ {
FMLLog.log(getModId(), Level.DEBUG, "Specified json URL invalid: %s", jsonURL); modLog.debug("Specified json URL invalid: {}", jsonURL);
} }
} }
} }
@ -287,7 +293,7 @@ public class FMLModContainer implements ModContainer
{ {
try try
{ {
FMLLog.log(getModId(), Level.DEBUG, "Attempting to load the file version.properties from %s to locate a version number for %s", getSource().getName(), getModId()); modLog.debug("Attempting to load the file version.properties from {} to locate a version number for {}", getSource().getName(), getModId());
Properties version = null; Properties version = null;
if (getSource().isFile()) if (getSource().isFile())
{ {
@ -330,7 +336,7 @@ public class FMLModContainer implements ModContainer
catch (Exception e) catch (Exception e)
{ {
Throwables.propagateIfPossible(e); Throwables.propagateIfPossible(e);
FMLLog.log(getModId(), Level.TRACE, "Failed to find a usable version.properties file"); modLog.trace("Failed to find a usable version.properties file");
return null; return null;
} }
} }
@ -382,7 +388,7 @@ public class FMLModContainer implements ModContainer
{ {
if (this.enabled) if (this.enabled)
{ {
FMLLog.log(getModId(), Level.DEBUG, "Enabling mod %s", getModId()); modLog.debug("Enabling mod {}", getModId());
this.eventBus = bus; this.eventBus = bus;
this.controller = controller; this.controller = controller;
eventBus.register(this); eventBus.register(this);
@ -412,7 +418,7 @@ public class FMLModContainer implements ModContainer
} }
else else
{ {
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()); modLog.error("The mod {} appears to have an invalid event annotation {}. 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)) else if (a.annotationType().equals(Mod.InstanceFactory.class))
@ -424,11 +430,11 @@ public class FMLModContainer implements ModContainer
} }
else if (!(Modifier.isStatic(m.getModifiers()) && m.getParameterTypes().length == 0)) else if (!(Modifier.isStatic(m.getModifiers()) && m.getParameterTypes().length == 0))
{ {
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())); modLog.error("The InstanceFactory annotation can only apply to a static method, taking zero arguments - it will be ignored on {}({})", m.getName(), Arrays.asList(m.getParameterTypes()));
} }
else if (factoryMethod != null) else if (factoryMethod != null)
{ {
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())); modLog.error("The InstanceFactory annotation can only be used once, the application to {}({}) will be ignored", m.getName(), Arrays.asList(m.getParameterTypes()));
} }
} }
} }
@ -472,13 +478,13 @@ public class FMLModContainer implements ModContainer
owner = ASMDataTable.getOwnerModID(mods, targets); owner = ASMDataTable.getOwnerModID(mods, targets);
if (Strings.isNullOrEmpty(owner)) if (Strings.isNullOrEmpty(owner))
{ {
FMLLog.bigWarning("Could not determine owning mod for @%s on %s for mod %s", annotationClassName, targets.getClassName(), this.getModId()); FMLLog.bigWarning("Could not determine owning mod for @{} on {} for mod {}", annotationClassName, targets.getClassName(), this.getModId());
continue; continue;
} }
} }
if (!this.getModId().equals(owner)) if (!this.getModId().equals(owner))
{ {
FMLLog.fine("Skipping @%s injection for %s.%s since it is not for mod %s", annotationClassName, targets.getClassName(), targets.getObjectName(), this.getModId()); FMLLog.log.debug("Skipping @{} injection for {}.{} since it is not for mod {}", annotationClassName, targets.getClassName(), targets.getObjectName(), this.getModId());
continue; continue;
} }
Field f = null; Field f = null;
@ -510,7 +516,7 @@ public class FMLModContainer implements ModContainer
catch (Exception e) catch (Exception e)
{ {
Throwables.propagateIfPossible(e); Throwables.propagateIfPossible(e);
FMLLog.log(getModId(), Level.WARN, e, "Attempting to load @%s in class %s for %s and failing", annotationName, targets.getClassName(), mc.getModId()); modLog.warn("Attempting to load @{} in class {} for {} and failing", annotationName, targets.getClassName(), mc.getModId(), e);
} }
} }
if (f != null) if (f != null)
@ -521,7 +527,7 @@ public class FMLModContainer implements ModContainer
target = modInstance; target = modInstance;
if (!modInstance.getClass().equals(clz)) if (!modInstance.getClass().equals(clz))
{ {
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()); modLog.warn("Unable to inject @{} in non-static field {}.{} for {} as it is NOT the primary mod instance", annotationName, targets.getClassName(), targets.getObjectName(), mc.getModId());
continue; continue;
} }
} }
@ -573,7 +579,7 @@ public class FMLModContainer implements ModContainer
{ {
warnLevel = Level.TRACE; 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()); modLog.log(warnLevel, "The mod {} is expecting signature {} for source {}, however there is no signature matching that description", getModId(), expectedFingerprint, source.getName());
} }
else else
{ {
@ -762,13 +768,13 @@ public class FMLModContainer implements ModContainer
if (clientSideOnly && side != Side.CLIENT) if (clientSideOnly && side != Side.CLIENT)
{ {
FMLLog.info("Disabling mod %s it is client side only.", getModId()); FMLLog.log.info("Disabling mod {} it is client side only.", getModId());
return false; return false;
} }
if (serverSideOnly && side != Side.SERVER) if (serverSideOnly && side != Side.SERVER)
{ {
FMLLog.info("Disabling mod %s it is server side only.", getModId()); FMLLog.log.info("Disabling mod {} it is server side only.", getModId());
return false; return false;
} }

View File

@ -74,7 +74,7 @@ public interface ILanguageAdapter {
catch (ClassNotFoundException e) catch (ClassNotFoundException e)
{ {
// Not a singleton, look for @Instance field as a fallback. // Not a singleton, look for @Instance field as a fallback.
FMLLog.log(Level.INFO, e, "An error occurred trying to load a proxy into %s.%s. Did you declare your mod as 'class' instead of 'object'?", proxyTarget.getSimpleName(), target.getName()); FMLLog.log.info("An error occurred trying to load a proxy into {}.{}. Did you declare your mod as 'class' instead of 'object'?", proxyTarget.getSimpleName(), target.getName(), e);
return; return;
} }
@ -110,12 +110,12 @@ public interface ILanguageAdapter {
} }
catch (InvocationTargetException e) catch (InvocationTargetException e)
{ {
FMLLog.log(Level.ERROR, e, "An error occurred trying to load a proxy into %s.%s", proxyTarget.getSimpleName(), target.getName()); FMLLog.log.error("An error occurred trying to load a proxy into {}.{}", target.getName(), e);
throw new LoaderException(e); throw new LoaderException(e);
} }
// If we come here we could not find a setter for this proxy. // If we come here we could not find a setter for this proxy.
FMLLog.severe("Failed loading proxy into %s.%s, could not find setter function. Did you declare the field with 'val' instead of 'var'?", proxyTarget.getSimpleName(), target.getName()); FMLLog.log.fatal("Failed loading proxy into {}.{}, could not find setter function. Did you declare the field with 'val' instead of 'var'?", proxyTarget.getSimpleName(), target.getName());
throw new LoaderException(String.format("Failed loading proxy into %s.%s, could not find setter function. Did you declare the field with 'val' instead of 'var'?", proxyTarget.getSimpleName(), target.getName())); throw new LoaderException(String.format("Failed loading proxy into %s.%s, could not find setter function. Did you declare the field with 'val' instead of 'var'?", proxyTarget.getSimpleName(), target.getName()));
} }
@ -160,14 +160,14 @@ public interface ILanguageAdapter {
if (!target.getType().isAssignableFrom(proxy.getClass())) if (!target.getType().isAssignableFrom(proxy.getClass()))
{ {
FMLLog.severe("Attempted to load a proxy type %s into %s.%s, but the types don't match", targetType, proxyTarget.getSimpleName(), target.getName()); FMLLog.log.fatal("Attempted to load a proxy type {} into {}.{}, but the types don't match", targetType, proxyTarget.getSimpleName(), target.getName());
throw new LoaderException(String.format("Attempted to load a proxy type %s into %s.%s, but the types don't match", targetType, proxyTarget.getSimpleName(), target.getName())); throw new LoaderException(String.format("Attempted to load a proxy type %s into %s.%s, but the types don't match", targetType, proxyTarget.getSimpleName(), target.getName()));
} }
setProxy(target, proxyTarget, proxy); setProxy(target, proxyTarget, proxy);
} }
catch (Exception e) { catch (Exception e) {
FMLLog.log(Level.ERROR, e, "An error occurred trying to load a proxy into %s.%s", proxyTarget.getSimpleName(), target.getName()); FMLLog.log.error("An error occurred trying to load a proxy into {}.{}", target.getName(), e);
throw new LoaderException(e); throw new LoaderException(e);
} }
} }
@ -175,7 +175,7 @@ public interface ILanguageAdapter {
} }
else else
{ {
FMLLog.finer("Mod does not appear to be a singleton."); FMLLog.log.trace("Mod does not appear to be a singleton.");
} }
} }
} }

View File

@ -37,6 +37,7 @@ import net.minecraftforge.fml.common.functions.ArtifactVersionNameFunction;
import net.minecraftforge.fml.common.versioning.ArtifactVersion; import net.minecraftforge.fml.common.versioning.ArtifactVersion;
import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.ThreadContext; import org.apache.logging.log4j.ThreadContext;
import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.ArrayListMultimap;
@ -79,7 +80,7 @@ public class LoadController
@Override @Override
public void handleException(Throwable exception, SubscriberExceptionContext context) public void handleException(Throwable exception, SubscriberExceptionContext context)
{ {
FMLLog.log("FMLMainChannel", Level.ERROR, exception, "Could not dispatch event: %s to %s", context.getEvent(), context.getSubscriberMethod()); FMLLog.log.error("Could not dispatch event: {} to {}", context.getSubscriberMethod(), exception);
} }
}); });
this.masterChannel.register(this); this.masterChannel.register(this);
@ -130,7 +131,7 @@ public class LoadController
} }
else else
{ {
FMLLog.log(mod.getModId(), Level.WARN, "Mod %s has been disabled through configuration", mod.getModId()); LogManager.getLogger(mod.getModId()).warn("Mod {} has been disabled through configuration", mod.getModId());
modStates.put(mod.getModId(), ModState.UNLOADED); modStates.put(mod.getModId(), ModState.UNLOADED);
modStates.put(mod.getModId(), ModState.DISABLED); modStates.put(mod.getModId(), ModState.DISABLED);
} }
@ -152,7 +153,7 @@ public class LoadController
{ {
if (FMLCommonHandler.instance().isDisplayCloseRequested()) if (FMLCommonHandler.instance().isDisplayCloseRequested())
{ {
FMLLog.info("The game window is being closed by the player, exiting."); FMLLog.log.info("The game window is being closed by the player, exiting.");
FMLCommonHandler.instance().exitJava(0, false); FMLCommonHandler.instance().exitJava(0, false);
} }
@ -161,18 +162,18 @@ public class LoadController
if (state != desiredState && !forceState) if (state != desiredState && !forceState)
{ {
Entry<String, Throwable> toThrow = null; Entry<String, Throwable> toThrow = null;
FMLLog.severe("Fatal errors were detected during the transition from %s to %s. Loading cannot continue", oldState, desiredState); FMLLog.log.fatal("Fatal errors were detected during the transition from {} to {}. Loading cannot continue", oldState, desiredState);
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
printModStates(sb); printModStates(sb);
FMLLog.severe("%s", sb.toString()); FMLLog.log.fatal(sb.toString());
if (errors.size()>0) if (errors.size()>0)
{ {
FMLLog.severe("The following problems were captured during this phase"); FMLLog.log.fatal("The following problems were captured during this phase");
for (Entry<String, Throwable> error : errors.entries()) for (Entry<String, Throwable> error : errors.entries())
{ {
String modId = error.getKey(); String modId = error.getKey();
String modName = modNames.get(modId); String modName = modNames.get(modId);
FMLLog.log(Level.ERROR, error.getValue(), "Caught exception from %s (%s)", modName, modId); FMLLog.log.error("Caught exception from {} ({})", modId, error.getValue());
if (error.getValue() instanceof IFMLHandledException) if (error.getValue() instanceof IFMLHandledException)
{ {
toThrow = error; toThrow = error;
@ -185,7 +186,7 @@ public class LoadController
} }
else else
{ {
FMLLog.severe("The ForgeModLoader state engine has become corrupted. Probably, a state was missed by and invalid modification to a base class" + FMLLog.log.fatal("The ForgeModLoader state engine has become corrupted. Probably, a state was missed by and invalid modification to a base class" +
"ForgeModLoader depends on. This is a critical error and not recoverable. Investigate any modifications to base classes outside of" + "ForgeModLoader depends on. This is a critical error and not recoverable. Investigate any modifications to base classes outside of" +
"ForgeModLoader, especially Optifine, to see if there are fixes available."); "ForgeModLoader, especially Optifine, to see if there are fixes available.");
throw new RuntimeException("The ForgeModLoader state engine is invalid"); throw new RuntimeException("The ForgeModLoader state engine is invalid");
@ -200,7 +201,7 @@ public class LoadController
} }
else if (state != desiredState && forceState) else if (state != desiredState && forceState)
{ {
FMLLog.info("The state engine was in incorrect state %s and forced into state %s. Errors may have been discarded.", state, desiredState); FMLLog.log.info("The state engine was in incorrect state {} and forced into state {}. Errors may have been discarded.", state, desiredState);
forceState(desiredState); forceState(desiredState);
} }
@ -240,7 +241,7 @@ public class LoadController
{ {
if (av.getLabel()!= null && requirements.contains(av.getLabel()) && modStates.containsEntry(av.getLabel(),ModState.ERRORED)) if (av.getLabel()!= null && requirements.contains(av.getLabel()) && modStates.containsEntry(av.getLabel(),ModState.ERRORED))
{ {
FMLLog.log(modId, Level.ERROR, "Skipping event %s and marking errored mod %s since required dependency %s has errored", stateEvent.getEventType(), modId, av.getLabel()); LogManager.getLogger(modId).error("Skipping event {} and marking errored mod {} since required dependency {} has errored", stateEvent.getEventType(), modId, av.getLabel());
modStates.put(modId, ModState.ERRORED); modStates.put(modId, ModState.ERRORED);
return; return;
} }
@ -248,9 +249,9 @@ public class LoadController
activeContainer = mc; activeContainer = mc;
stateEvent.applyModContainer(mc); stateEvent.applyModContainer(mc);
ThreadContext.put("mod", modId); ThreadContext.put("mod", modId);
FMLLog.log(modId, Level.TRACE, "Sending event %s to mod %s", stateEvent.getEventType(), modId); LogManager.getLogger(modId).trace("Sending event {} to mod {}", stateEvent.getEventType(), modId);
eventChannels.get(modId).post(stateEvent); eventChannels.get(modId).post(stateEvent);
FMLLog.log(modId, Level.TRACE, "Sent event %s to mod %s", stateEvent.getEventType(), modId); LogManager.getLogger(modId).trace("Sent event {} to mod {}", stateEvent.getEventType(), modId);
ThreadContext.remove("mod"); ThreadContext.remove("mod");
activeContainer = null; activeContainer = null;
if (stateEvent instanceof FMLStateEvent) if (stateEvent instanceof FMLStateEvent)
@ -282,7 +283,7 @@ public class LoadController
} }
if (mc.getMod()==null && !mc.isImmutable() && state!=LoaderState.CONSTRUCTING) if (mc.getMod()==null && !mc.isImmutable() && state!=LoaderState.CONSTRUCTING)
{ {
FMLLog.severe("There is a severe problem with %s - it appears not to have constructed correctly", mc.getModId()); FMLLog.log.fatal("There is a severe problem with {} - it appears not to have constructed correctly", mc.getModId());
if (state != LoaderState.CONSTRUCTING) if (state != LoaderState.CONSTRUCTING)
{ {
this.errorOccurred(mc, new RuntimeException()); this.errorOccurred(mc, new RuntimeException());
@ -338,7 +339,7 @@ public class LoadController
} }
catch (Exception e) catch (Exception e)
{ {
FMLLog.log(Level.ERROR, e, "An unexpected exception"); FMLLog.log.error("An unexpected exception", e);
throw new LoaderException(e); throw new LoaderException(e);
} }
} }
@ -347,7 +348,7 @@ public class LoadController
{ {
if (modObjectList == null) if (modObjectList == null)
{ {
FMLLog.severe("Detected an attempt by a mod %s to perform game activity during mod construction. This is a serious programming error.", activeContainer); FMLLog.log.fatal("Detected an attempt by a mod {} to perform game activity during mod construction. This is a serious programming error.", activeContainer);
return buildModObjectList(); return buildModObjectList();
} }
return ImmutableBiMap.copyOf(modObjectList); return ImmutableBiMap.copyOf(modObjectList);

View File

@ -207,13 +207,13 @@ public class Loader
java8 = major > 7; java8 = major > 7;
if (!java8) if (!java8)
{ {
FMLLog.severe("The game is not running with Java 8. Forge recommends Java 8 for maximum compatibility with mods"); FMLLog.log.fatal("The game is not running with Java 8. Forge recommends Java 8 for maximum compatibility with mods");
} }
modClassLoader = new ModClassLoader(getClass().getClassLoader()); modClassLoader = new ModClassLoader(getClass().getClassLoader());
if (mccversion !=null && !mccversion.equals(MC_VERSION)) if (mccversion !=null && !mccversion.equals(MC_VERSION))
{ {
FMLLog.severe("This version of FML is built for Minecraft %s, we have detected Minecraft %s in your minecraft jar file", mccversion, MC_VERSION); FMLLog.log.fatal("This version of FML is built for Minecraft {}, we have detected Minecraft {} in your minecraft jar file", mccversion, MC_VERSION);
throw new LoaderException(String.format("This version of FML is built for Minecraft %s, we have detected Minecraft %s in your minecraft jar file", mccversion, MC_VERSION)); throw new LoaderException(String.format("This version of FML is built for Minecraft %s, we have detected Minecraft %s in your minecraft jar file", mccversion, MC_VERSION));
} }
@ -236,7 +236,7 @@ public class Loader
*/ */
private void sortModList() private void sortModList()
{ {
FMLLog.finer("Verifying mod requirements are satisfied"); FMLLog.log.trace("Verifying mod requirements are satisfied");
List<WrongMinecraftVersionException> wrongMinecraftExceptions = new ArrayList<WrongMinecraftVersionException>(); List<WrongMinecraftVersionException> wrongMinecraftExceptions = new ArrayList<WrongMinecraftVersionException>();
List<MissingModsException> missingModsExceptions = new ArrayList<MissingModsException>(); List<MissingModsException> missingModsExceptions = new ArrayList<MissingModsException>();
try try
@ -252,9 +252,9 @@ public class Loader
{ {
if (!mod.acceptableMinecraftVersionRange().containsVersion(minecraft.getProcessedVersion())) if (!mod.acceptableMinecraftVersionRange().containsVersion(minecraft.getProcessedVersion()))
{ {
FMLLog.severe("The mod %s does not wish to run in Minecraft version %s. You will have to remove it to play.", mod.getModId(), getMCVersionString()); FMLLog.log.fatal("The mod {} does not wish to run in Minecraft version {}. You will have to remove it to play.", mod.getModId(), getMCVersionString());
WrongMinecraftVersionException ret = new WrongMinecraftVersionException(mod, getMCVersionString()); WrongMinecraftVersionException ret = new WrongMinecraftVersionException(mod, getMCVersionString());
FMLLog.severe(ret.getMessage()); FMLLog.log.fatal(ret.getMessage());
wrongMinecraftExceptions.add(ret); wrongMinecraftExceptions.add(ret);
continue; continue;
} }
@ -264,13 +264,13 @@ public class Loader
Set<String> missingMods = Sets.difference(names.keySet(), modVersions.keySet()); Set<String> missingMods = Sets.difference(names.keySet(), modVersions.keySet());
if (!missingMods.isEmpty()) if (!missingMods.isEmpty())
{ {
FMLLog.severe("The mod %s (%s) requires mods %s to be available", mod.getModId(), mod.getName(), missingMods); FMLLog.log.fatal("The mod {} ({}) requires mods {} to be available", mod.getModId(), mod.getName(), missingMods);
for (String modid : missingMods) for (String modid : missingMods)
{ {
versionMissingMods.add(names.get(modid)); versionMissingMods.add(names.get(modid));
} }
MissingModsException ret = new MissingModsException(versionMissingMods, mod.getModId(), mod.getName()); MissingModsException ret = new MissingModsException(versionMissingMods, mod.getModId(), mod.getName());
FMLLog.severe(ret.getMessage()); FMLLog.log.fatal(ret.getMessage());
missingModsExceptions.add(ret); missingModsExceptions.add(ret);
continue; continue;
} }
@ -288,16 +288,16 @@ public class Loader
} }
if (!versionMissingMods.isEmpty()) if (!versionMissingMods.isEmpty())
{ {
FMLLog.severe("The mod %s (%s) requires mod versions %s to be available", mod.getModId(), mod.getName(), versionMissingMods); FMLLog.log.fatal("The mod {} ({}) requires mod versions {} to be available", mod.getModId(), mod.getName(), versionMissingMods);
MissingModsException ret = new MissingModsException(versionMissingMods, mod.getModId(), mod.getName()); MissingModsException ret = new MissingModsException(versionMissingMods, mod.getModId(), mod.getName());
FMLLog.severe(ret.toString()); FMLLog.log.fatal(ret.toString());
missingModsExceptions.add(ret); missingModsExceptions.add(ret);
} }
} }
if (wrongMinecraftExceptions.isEmpty() && missingModsExceptions.isEmpty()) if (wrongMinecraftExceptions.isEmpty() && missingModsExceptions.isEmpty())
{ {
FMLLog.finer("All mod requirements are satisfied"); FMLLog.log.trace("All mod requirements are satisfied");
} }
else if (missingModsExceptions.size()==1 && wrongMinecraftExceptions.isEmpty()) else if (missingModsExceptions.size()==1 && wrongMinecraftExceptions.isEmpty())
{ {
@ -317,7 +317,7 @@ public class Loader
try try
{ {
FMLLog.finer("Sorting mods into an ordered list"); FMLLog.log.trace("Sorting mods into an ordered list");
List<ModContainer> sortedMods = sorter.sort(); List<ModContainer> sortedMods = sorter.sort();
// Reset active list to the sorted list // Reset active list to the sorted list
modController.getActiveModList().clear(); modController.getActiveModList().clear();
@ -326,37 +326,37 @@ public class Loader
mods.removeAll(sortedMods); mods.removeAll(sortedMods);
sortedMods.addAll(mods); sortedMods.addAll(mods);
mods = sortedMods; mods = sortedMods;
FMLLog.finer("Mod sorting completed successfully"); FMLLog.log.trace("Mod sorting completed successfully");
} }
catch (ModSortingException sortException) catch (ModSortingException sortException)
{ {
FMLLog.severe("A dependency cycle was detected in the input mod set so an ordering cannot be determined"); FMLLog.log.fatal("A dependency cycle was detected in the input mod set so an ordering cannot be determined");
SortingExceptionData<ModContainer> exceptionData = sortException.getExceptionData(); SortingExceptionData<ModContainer> exceptionData = sortException.getExceptionData();
FMLLog.severe("The first mod in the cycle is %s", exceptionData.getFirstBadNode()); FMLLog.log.fatal("The first mod in the cycle is {}", exceptionData.getFirstBadNode());
FMLLog.severe("The mod cycle involves"); FMLLog.log.fatal("The mod cycle involves");
for (ModContainer mc : exceptionData.getVisitedNodes()) for (ModContainer mc : exceptionData.getVisitedNodes())
{ {
FMLLog.severe("%s : before: %s, after: %s", mc.toString(), mc.getDependants(), mc.getDependencies()); FMLLog.log.fatal("{} : before: {}, after: {}", mc.toString(), mc.getDependants(), mc.getDependencies());
} }
FMLLog.log(Level.ERROR, sortException, "The full error"); FMLLog.log.error("The full error", sortException);
throw sortException; throw sortException;
} }
} }
finally finally
{ {
FMLLog.fine("Mod sorting data"); FMLLog.log.debug("Mod sorting data");
int unprintedMods = mods.size(); int unprintedMods = mods.size();
for (ModContainer mod : getActiveModList()) for (ModContainer mod : getActiveModList())
{ {
if (!mod.isImmutable()) if (!mod.isImmutable())
{ {
FMLLog.fine("\t%s(%s:%s): %s (%s)", mod.getModId(), mod.getName(), mod.getVersion(), mod.getSource().getName(), mod.getSortingRules()); FMLLog.log.debug("\t{}({}:{}): {} ({})", mod.getModId(), mod.getName(), mod.getVersion(), mod.getSource().getName(), mod.getSortingRules());
unprintedMods--; unprintedMods--;
} }
} }
if (unprintedMods == mods.size()) if (unprintedMods == mods.size())
{ {
FMLLog.fine("No user mods found to sort"); FMLLog.log.debug("No user mods found to sort");
} }
} }
@ -379,7 +379,7 @@ public class Loader
private ModDiscoverer identifyMods(List<String> additionalContainers) private ModDiscoverer identifyMods(List<String> additionalContainers)
{ {
injectedContainers.addAll(additionalContainers); injectedContainers.addAll(additionalContainers);
FMLLog.fine("Building injected Mod Containers %s", injectedContainers); FMLLog.log.debug("Building injected Mod Containers {}", injectedContainers);
mods.add(minecraft); mods.add(minecraft);
// Add in the MCP mod container // Add in the MCP mod container
mods.add(new InjectedModContainer(mcp,new File("minecraft.jar"))); mods.add(new InjectedModContainer(mcp,new File("minecraft.jar")));
@ -392,30 +392,30 @@ public class Loader
} }
catch (Exception e) catch (Exception e)
{ {
FMLLog.log(Level.ERROR, e, "A problem occurred instantiating the injected mod container %s", cont); FMLLog.log.error("A problem occurred instantiating the injected mod container {}", cont, e);
throw new LoaderException(e); throw new LoaderException(e);
} }
mods.add(new InjectedModContainer(mc,mc.getSource())); mods.add(new InjectedModContainer(mc,mc.getSource()));
} }
ModDiscoverer discoverer = new ModDiscoverer(); ModDiscoverer discoverer = new ModDiscoverer();
FMLLog.fine("Attempting to load mods contained in the minecraft jar file and associated classes"); FMLLog.log.debug("Attempting to load mods contained in the minecraft jar file and associated classes");
discoverer.findClasspathMods(modClassLoader); discoverer.findClasspathMods(modClassLoader);
FMLLog.fine("Minecraft jar mods loaded successfully"); FMLLog.log.debug("Minecraft jar mods loaded successfully");
FMLLog.getLogger().log(Level.INFO, "Found {} mods from the command line. Injecting into mod discoverer",ModListHelper.additionalMods.size()); FMLLog.log.info("Found {} mods from the command line. Injecting into mod discoverer", ModListHelper.additionalMods.size());
FMLLog.info("Searching %s for mods", canonicalModsDir.getAbsolutePath()); FMLLog.log.info("Searching {} for mods", canonicalModsDir.getAbsolutePath());
discoverer.findModDirMods(canonicalModsDir, ModListHelper.additionalMods.values().toArray(new File[0])); discoverer.findModDirMods(canonicalModsDir, ModListHelper.additionalMods.values().toArray(new File[0]));
File versionSpecificModsDir = new File(canonicalModsDir,mccversion); File versionSpecificModsDir = new File(canonicalModsDir,mccversion);
if (versionSpecificModsDir.isDirectory()) if (versionSpecificModsDir.isDirectory())
{ {
FMLLog.info("Also searching %s for mods", versionSpecificModsDir); FMLLog.log.info("Also searching {} for mods", versionSpecificModsDir);
discoverer.findModDirMods(versionSpecificModsDir); discoverer.findModDirMods(versionSpecificModsDir);
} }
mods.addAll(discoverer.identifyMods()); mods.addAll(discoverer.identifyMods());
identifyDuplicates(mods); identifyDuplicates(mods);
namedMods = Maps.uniqueIndex(mods, new ModIdFunction()); namedMods = Maps.uniqueIndex(mods, new ModIdFunction());
FMLLog.info("Forge Mod Loader has identified %d mod%s to load", mods.size(), mods.size() != 1 ? "s" : ""); FMLLog.log.info("Forge Mod Loader has identified {} mod{} to load", mods.size(), mods.size() != 1 ? "s" : "");
return discoverer; return discoverer;
} }
@ -445,7 +445,7 @@ public class Loader
{ {
if (e.getCount() > 1) if (e.getCount() > 1)
{ {
FMLLog.severe("Found a duplicate mod %s at %s", e.getElement().getModId(), dupsearch.get(e.getElement())); FMLLog.log.fatal("Found a duplicate mod {} at {}", e.getElement().getModId(), dupsearch.get(e.getElement()));
dupes.putAll(e.getElement(),dupsearch.get(e.getElement())); dupes.putAll(e.getElement(),dupsearch.get(e.getElement()));
} }
} }
@ -474,44 +474,44 @@ public class Loader
} }
catch (IOException ioe) catch (IOException ioe)
{ {
FMLLog.log(Level.ERROR, ioe, "Failed to resolve loader directories: mods : %s ; config %s", canonicalModsDir.getAbsolutePath(), FMLLog.log.error("Failed to resolve loader directories: mods : {} ; config {}", canonicalModsDir.getAbsolutePath(),
configDir.getAbsolutePath()); configDir.getAbsolutePath(), ioe);
throw new LoaderException(ioe); throw new LoaderException(ioe);
} }
if (!canonicalModsDir.exists()) if (!canonicalModsDir.exists())
{ {
FMLLog.info("No mod directory found, creating one: %s", canonicalModsPath); FMLLog.log.info("No mod directory found, creating one: {}", canonicalModsPath);
boolean dirMade = canonicalModsDir.mkdir(); boolean dirMade = canonicalModsDir.mkdir();
if (!dirMade) if (!dirMade)
{ {
FMLLog.severe("Unable to create the mod directory %s", canonicalModsPath); FMLLog.log.fatal("Unable to create the mod directory {}", canonicalModsPath);
throw new LoaderException(String.format("Unable to create the mod directory %s", canonicalModsPath)); throw new LoaderException(String.format("Unable to create the mod directory %s", canonicalModsPath));
} }
FMLLog.info("Mod directory created successfully"); FMLLog.log.info("Mod directory created successfully");
} }
if (!canonicalConfigDir.exists()) if (!canonicalConfigDir.exists())
{ {
FMLLog.fine("No config directory found, creating one: %s", canonicalConfigPath); FMLLog.log.debug("No config directory found, creating one: {}", canonicalConfigPath);
boolean dirMade = canonicalConfigDir.mkdir(); boolean dirMade = canonicalConfigDir.mkdir();
if (!dirMade) if (!dirMade)
{ {
FMLLog.severe("Unable to create the config directory %s", canonicalConfigPath); FMLLog.log.fatal("Unable to create the config directory {}", canonicalConfigPath);
throw new LoaderException(); throw new LoaderException();
} }
FMLLog.info("Config directory created successfully"); FMLLog.log.info("Config directory created successfully");
} }
if (!canonicalModsDir.isDirectory()) if (!canonicalModsDir.isDirectory())
{ {
FMLLog.severe("Attempting to load mods from %s, which is not a directory", canonicalModsPath); FMLLog.log.fatal("Attempting to load mods from {}, which is not a directory", canonicalModsPath);
throw new LoaderException(); throw new LoaderException();
} }
if (!configDir.isDirectory()) if (!configDir.isDirectory())
{ {
FMLLog.severe("Attempting to load configuration from %s, which is not a directory", canonicalConfigPath); FMLLog.log.fatal("Attempting to load configuration from {}, which is not a directory", canonicalConfigPath);
throw new LoaderException(); throw new LoaderException();
} }
@ -565,14 +565,14 @@ public class Loader
{ {
if (nonMod.isFile()) if (nonMod.isFile())
{ {
FMLLog.info("FML has found a non-mod file %s in your mods directory. It will now be injected into your classpath. This could severe stability issues, it should be removed if possible.", nonMod.getName()); FMLLog.log.info("FML has found a non-mod file {} in your mods directory. It will now be injected into your classpath. This could severe stability issues, it should be removed if possible.", nonMod.getName());
try try
{ {
modClassLoader.addFile(nonMod); modClassLoader.addFile(nonMod);
} }
catch (MalformedURLException e) catch (MalformedURLException e)
{ {
FMLLog.log(Level.ERROR, e, "Encountered a weird problem with non-mod file injection : %s", nonMod.getName()); FMLLog.log.error("Encountered a weird problem with non-mod file injection : {}", nonMod.getName(), e);
} }
} }
} }
@ -593,22 +593,22 @@ public class Loader
} }
}); });
FMLLog.fine("Mod signature data"); FMLLog.log.debug("Mod signature data");
FMLLog.fine(" \tValid Signatures:"); FMLLog.log.debug(" \tValid Signatures:");
for (ModContainer mod : getActiveModList()) for (ModContainer mod : getActiveModList())
{ {
if (mod.getSigningCertificate() != null) if (mod.getSigningCertificate() != null)
FMLLog.fine("\t\t(%s) %s\t(%s\t%s)\t%s", CertificateHelper.getFingerprint(mod.getSigningCertificate()), mod.getModId(), mod.getName(), mod.getVersion(), mod.getSource().getName()); FMLLog.log.debug("\t\t({}) {}\t({}\t{})\t{}", CertificateHelper.getFingerprint(mod.getSigningCertificate()), mod.getModId(), mod.getName(), mod.getVersion(), mod.getSource().getName());
} }
FMLLog.fine(" \tMissing Signatures:"); FMLLog.log.debug(" \tMissing Signatures:");
for (ModContainer mod : getActiveModList()) for (ModContainer mod : getActiveModList())
{ {
if (mod.getSigningCertificate() == null) if (mod.getSigningCertificate() == null)
FMLLog.fine("\t\t%s\t(%s\t%s)\t%s", mod.getModId(), mod.getName(), mod.getVersion(), mod.getSource().getName()); FMLLog.log.debug("\t\t{}\t({}\t{})\t{}", mod.getModId(), mod.getName(), mod.getVersion(), mod.getSource().getName());
} }
if (getActiveModList().isEmpty()) if (getActiveModList().isEmpty())
{ {
FMLLog.fine("No user mod signature data found"); FMLLog.log.debug("No user mod signature data found");
} }
progressBar.step("Initializing mods Phase 1"); progressBar.step("Initializing mods Phase 1");
modController.transition(LoaderState.PREINITIALIZATION, false); modController.transition(LoaderState.PREINITIALIZATION, false);
@ -636,7 +636,7 @@ public class Loader
{ {
if (!modController.isInState(LoaderState.PREINITIALIZATION)) if (!modController.isInState(LoaderState.PREINITIALIZATION))
{ {
FMLLog.warning("There were errors previously. Not beginning mod initialization phase"); FMLLog.log.warn("There were errors previously. Not beginning mod initialization phase");
return; return;
} }
PersistentRegistryManager.fireCreateRegistryEvents(); PersistentRegistryManager.fireCreateRegistryEvents();
@ -655,31 +655,31 @@ public class Loader
private void disableRequestedMods() private void disableRequestedMods()
{ {
String forcedModList = System.getProperty("fml.modStates", ""); String forcedModList = System.getProperty("fml.modStates", "");
FMLLog.finer("Received a system property request \'%s\'",forcedModList); FMLLog.log.trace("Received a system property request \'{}\'",forcedModList);
Map<String, String> sysPropertyStateList = Splitter.on(CharMatcher.anyOf(";:")) Map<String, String> sysPropertyStateList = Splitter.on(CharMatcher.anyOf(";:"))
.omitEmptyStrings().trimResults().withKeyValueSeparator("=") .omitEmptyStrings().trimResults().withKeyValueSeparator("=")
.split(forcedModList); .split(forcedModList);
FMLLog.finer("System property request managing the state of %d mods", sysPropertyStateList.size()); FMLLog.log.trace("System property request managing the state of {} mods", sysPropertyStateList.size());
Map<String, String> modStates = Maps.newHashMap(); Map<String, String> modStates = Maps.newHashMap();
forcedModFile = new File(canonicalConfigDir, "fmlModState.properties"); forcedModFile = new File(canonicalConfigDir, "fmlModState.properties");
Properties forcedModListProperties = new Properties(); Properties forcedModListProperties = new Properties();
if (forcedModFile.exists() && forcedModFile.isFile()) if (forcedModFile.exists() && forcedModFile.isFile())
{ {
FMLLog.finer("Found a mod state file %s", forcedModFile.getName()); FMLLog.log.trace("Found a mod state file {}", forcedModFile.getName());
try try
{ {
forcedModListProperties.load(new FileReader(forcedModFile)); forcedModListProperties.load(new FileReader(forcedModFile));
FMLLog.finer("Loaded states for %d mods from file", forcedModListProperties.size()); FMLLog.log.trace("Loaded states for {} mods from file", forcedModListProperties.size());
} }
catch (Exception e) catch (Exception e)
{ {
FMLLog.log(Level.INFO, e, "An error occurred reading the fmlModState.properties file"); FMLLog.log.info("An error occurred reading the fmlModState.properties file", e);
} }
} }
modStates.putAll(Maps.fromProperties(forcedModListProperties)); modStates.putAll(Maps.fromProperties(forcedModListProperties));
modStates.putAll(sysPropertyStateList); modStates.putAll(sysPropertyStateList);
FMLLog.fine("After merging, found state information for %d mods", modStates.size()); FMLLog.log.debug("After merging, found state information for {} mods", modStates.size());
Map<String, Boolean> isEnabled = Maps.transformValues(modStates, new Function<String, Boolean>() Map<String, Boolean> isEnabled = Maps.transformValues(modStates, new Function<String, Boolean>()
{ {
@ -694,7 +694,7 @@ public class Loader
{ {
if (namedMods.containsKey(entry.getKey())) if (namedMods.containsKey(entry.getKey()))
{ {
FMLLog.info("Setting mod %s to enabled state %b", entry.getKey(), entry.getValue()); FMLLog.log.info("Setting mod {} to enabled state {}", entry.getKey(), entry.getValue());
namedMods.get(entry.getKey()).setEnabledState(entry.getValue()); namedMods.get(entry.getKey()).setEnabledState(entry.getValue());
} }
} }
@ -812,7 +812,7 @@ public class Loader
if (parseFailure) if (parseFailure)
{ {
FMLLog.log(Level.WARN, "Unable to parse dependency string %s", dependencyString); FMLLog.log.warn("Unable to parse dependency string {}", dependencyString);
throw new LoaderException(String.format("Unable to parse dependency string %s", dependencyString)); throw new LoaderException(String.format("Unable to parse dependency string %s", dependencyString));
} }
} }
@ -837,7 +837,7 @@ public class Loader
modController.transition(LoaderState.AVAILABLE, false); modController.transition(LoaderState.AVAILABLE, false);
modController.distributeStateMessage(LoaderState.AVAILABLE); modController.distributeStateMessage(LoaderState.AVAILABLE);
PersistentRegistryManager.freezeData(); PersistentRegistryManager.freezeData();
FMLLog.info("Forge Mod Loader has successfully loaded %d mod%s", mods.size(), mods.size() == 1 ? "" : "s"); FMLLog.log.info("Forge Mod Loader has successfully loaded {} mod{}", mods.size(), mods.size() == 1 ? "" : "s");
progressBar.step("Completing Minecraft initialization"); progressBar.step("Completing Minecraft initialization");
} }
@ -882,7 +882,7 @@ public class Loader
} }
catch (Throwable t) catch (Throwable t)
{ {
FMLLog.log(Level.ERROR, t, "A fatal exception occurred during the server starting event"); FMLLog.log.error("A fatal exception occurred during the server starting event", t);
return false; return false;
} }
return true; return true;
@ -953,7 +953,7 @@ public class Loader
} }
catch (Throwable t) catch (Throwable t)
{ {
FMLLog.log(Level.ERROR, t, "A fatal exception occurred during the server about to start event"); FMLLog.log.error("A fatal exception occurred during the server about to start event", t);
return false; return false;
} }
return true; return true;
@ -1000,7 +1000,7 @@ public class Loader
} }
if (difference.size() > 0) if (difference.size() > 0)
FMLLog.info("Attempting connection with missing mods %s at %s", difference, side); FMLLog.log.info("Attempting connection with missing mods {} at {}", difference, side);
return true; return true;
} }
@ -1022,7 +1022,7 @@ public class Loader
return ImmutableList.of(); return ImmutableList.of();
} }
FMLLog.fine("There are %d mappings missing - attempting a mod remap", missingBlocks.size() + missingItems.size()); FMLLog.log.debug("There are {} mappings missing - attempting a mod remap", missingBlocks.size() + missingItems.size());
ArrayListMultimap<String, MissingMapping> missingMappings = ArrayListMultimap.create(); ArrayListMultimap<String, MissingMapping> missingMappings = ArrayListMultimap.create();
for (Map.Entry<ResourceLocation, Integer> mapping : missingBlocks.entrySet()) for (Map.Entry<ResourceLocation, Integer> mapping : missingBlocks.entrySet())
@ -1049,11 +1049,11 @@ public class Loader
{ {
if (!didWarn) if (!didWarn)
{ {
FMLLog.severe("There are unidentified mappings in this world - we are going to attempt to process anyway"); FMLLog.log.fatal("There are unidentified mappings in this world - we are going to attempt to process anyway");
didWarn = true; didWarn = true;
} }
FMLLog.severe("Unidentified %s: %s, id %d", mapping.type == Type.BLOCK ? "block" : "item", mapping.name, mapping.id); FMLLog.log.fatal("Unidentified {}: {}, id {}", mapping.type == Type.BLOCK ? "block" : "item", mapping.name, mapping.id);
} }
} }
} }
@ -1092,17 +1092,17 @@ public class Loader
Disableable disableable = mc.canBeDisabled(); Disableable disableable = mc.canBeDisabled();
if (disableable == Disableable.NEVER) if (disableable == Disableable.NEVER)
{ {
FMLLog.info("Cannot disable mod %s - it is never allowed to be disabled", modId); FMLLog.log.info("Cannot disable mod {} - it is never allowed to be disabled", modId);
return; return;
} }
if (disableable == Disableable.DEPENDENCIES) if (disableable == Disableable.DEPENDENCIES)
{ {
FMLLog.info("Cannot disable mod %s - there are dependent mods that require its presence", modId); FMLLog.log.info("Cannot disable mod {} - there are dependent mods that require its presence", modId);
return; return;
} }
if (disableable == Disableable.YES) if (disableable == Disableable.YES)
{ {
FMLLog.info("Runtime disabling mod %s", modId); FMLLog.log.info("Runtime disabling mod {}", modId);
modController.disableMod(mc); modController.disableMod(mc);
List<ModContainer> localmods = Lists.newArrayList(mods); List<ModContainer> localmods = Lists.newArrayList(mods);
localmods.remove(mc); localmods.remove(mc);
@ -1118,7 +1118,7 @@ public class Loader
} }
catch (Exception e) catch (Exception e)
{ {
FMLLog.log(Level.INFO, e, "An error occurred writing the fml mod states file, your disabled change won't persist"); FMLLog.log.info("An error occurred writing the fml mod states file, your disabled change won't persist", e);
} }
} }
@ -1136,7 +1136,7 @@ public class Loader
File injectedDepFile = new File(getConfigDir(),"injectedDependencies.json"); File injectedDepFile = new File(getConfigDir(),"injectedDependencies.json");
if (!injectedDepFile.exists()) if (!injectedDepFile.exists())
{ {
FMLLog.getLogger().log(Level.DEBUG, "File {} not found. No dependencies injected", injectedDepFile.getAbsolutePath()); FMLLog.log.debug("File {} not found. No dependencies injected", injectedDepFile.getAbsolutePath());
return; return;
} }
JsonParser parser = new JsonParser(); JsonParser parser = new JsonParser();
@ -1158,18 +1158,18 @@ public class Loader
} else if (type.equals("after")) { } else if (type.equals("after")) {
injectedAfter.put(modId, VersionParser.parseVersionReference(depObj.get("target").getAsString())); injectedAfter.put(modId, VersionParser.parseVersionReference(depObj.get("target").getAsString()));
} else { } else {
FMLLog.getLogger().log(Level.ERROR, "Invalid dependency type {}", type); FMLLog.log.error("Invalid dependency type {}", type);
throw new RuntimeException("Unable to parse type"); throw new RuntimeException("Unable to parse type");
} }
} }
} }
} catch (Exception e) } catch (Exception e)
{ {
FMLLog.getLogger().log(Level.ERROR, "Unable to parse {} - skipping", injectedDepFile); FMLLog.log.error("Unable to parse {} - skipping", injectedDepFile);
FMLLog.getLogger().throwing(Level.ERROR, e); FMLLog.log.throwing(Level.ERROR, e);
return; return;
} }
FMLLog.getLogger().log(Level.DEBUG, "Loaded {} injected dependencies on modIds: {}", injectedBefore.size(), injectedBefore.keySet()); FMLLog.log.debug("Loaded {} injected dependencies on modIds: {}", injectedBefore.size(), injectedBefore.keySet());
} }
List<ArtifactVersion> getInjectedBefore(String modId) List<ArtifactVersion> getInjectedBefore(String modId)

View File

@ -83,7 +83,7 @@ public class MetadataCollection
} }
catch (JsonParseException e) catch (JsonParseException e)
{ {
FMLLog.log(Level.ERROR, e, "The mcmod.info file in %s cannot be parsed as valid JSON. It will be ignored", sourceName); FMLLog.log.error("The mcmod.info file in {} cannot be parsed as valid JSON. It will be ignored", sourceName, e);
return new MetadataCollection(); return new MetadataCollection();
} }
catch (Exception e) catch (Exception e)

View File

@ -110,7 +110,7 @@ public class ModAPIManager {
public void validate(String providedAPI, String apiOwner, String apiVersion) public void validate(String providedAPI, String apiOwner, String apiVersion)
{ {
if (Loader.instance().getModClassLoader().containsSource(this.getSource())) { if (Loader.instance().getModClassLoader().containsSource(this.getSource())) {
FMLLog.bigWarning("The API %s from source %s is loaded from an incompatible classloader. THIS WILL NOT WORK!", providedAPI, this.getSource().getAbsolutePath()); FMLLog.bigWarning("The API {} from source {} is loaded from an incompatible classloader. THIS WILL NOT WORK!", providedAPI, this.getSource().getAbsolutePath());
} }
// TODO Compare this annotation data to the one we first found. Maybe barf if there is inconsistency? // TODO Compare this annotation data to the one we first found. Maybe barf if there is inconsistency?
} }
@ -180,7 +180,7 @@ public class ModAPIManager {
{ {
continue; continue;
} }
FMLLog.fine("Found API %s (owned by %s providing %s) embedded in %s",apiPackage, apiOwner, providedAPI, embeddedIn); FMLLog.log.debug("Found API {} (owned by {} providing {}) embedded in {}",apiPackage, apiOwner, providedAPI, embeddedIn);
if (!embeddedIn.equals(apiOwner)) if (!embeddedIn.equals(apiOwner))
{ {
container.addAPIReference(embeddedIn); container.addAPIReference(embeddedIn);
@ -198,7 +198,7 @@ public class ModAPIManager {
List<String> candidateIds = Lists.transform(candidate.getContainedMods(), new ModIdFunction()); List<String> candidateIds = Lists.transform(candidate.getContainedMods(), new ModIdFunction());
if (!candidateIds.contains(container.ownerMod.getLabel()) && !container.currentReferents.containsAll(candidateIds)) if (!candidateIds.contains(container.ownerMod.getLabel()) && !container.currentReferents.containsAll(candidateIds))
{ {
FMLLog.info("Found mod(s) %s containing declared API package %s (owned by %s) without associated API reference",candidateIds, pkg, container.ownerMod); FMLLog.log.info("Found mod(s) {} containing declared API package {} (owned by {}) without associated API reference",candidateIds, pkg, container.ownerMod);
container.addAPIReferences(candidateIds); container.addAPIReferences(candidateIds);
} }
} }
@ -211,18 +211,18 @@ public class ModAPIManager {
APIContainer parent = apiContainers.get(owner.getLabel()); APIContainer parent = apiContainers.get(owner.getLabel());
if (parent == container) if (parent == container)
{ {
FMLLog.finer("APIContainer %s is it's own parent. skipping", owner); FMLLog.log.trace("APIContainer {} is it's own parent. skipping", owner);
container.markSelfReferenced(); container.markSelfReferenced();
break; break;
} }
FMLLog.finer("Removing upstream parent %s from %s", parent.ownerMod.getLabel(), container); FMLLog.log.trace("Removing upstream parent {} from {}", parent.ownerMod.getLabel(), container);
container.currentReferents.remove(parent.ownerMod.getLabel()); container.currentReferents.remove(parent.ownerMod.getLabel());
container.referredMods.remove(parent.ownerMod); container.referredMods.remove(parent.ownerMod);
owner = parent.ownerMod; owner = parent.ownerMod;
} }
while (apiContainers.containsKey(owner.getLabel())); while (apiContainers.containsKey(owner.getLabel()));
} }
FMLLog.fine("Creating API container dummy for API %s: owner: %s, dependents: %s", container.providedAPI, container.ownerMod, container.referredMods); FMLLog.log.debug("Creating API container dummy for API {}: owner: {}, dependents: {}", container.providedAPI, container.ownerMod, container.referredMods);
} }
} }

View File

@ -91,7 +91,7 @@ public class ModClassLoader extends URLClassLoader
} }
catch (URISyntaxException e) catch (URISyntaxException e)
{ {
FMLLog.log(Level.ERROR, e, "Unable to process our input to locate the minecraft code"); FMLLog.log.error("Unable to process our input to locate the minecraft code", e);
throw new LoaderException(e); throw new LoaderException(e);
} }
} }

View File

@ -56,7 +56,7 @@ public class ModContainerFactory
Constructor<? extends ModContainer> constructor = container.getConstructor(new Class<?>[] { String.class, ModCandidate.class, Map.class }); Constructor<? extends ModContainer> constructor = container.getConstructor(new Class<?>[] { String.class, ModCandidate.class, Map.class });
modTypes.put(type, constructor); modTypes.put(type, constructor);
} catch (Exception e) { } catch (Exception e) {
FMLLog.log(Level.ERROR, e, "Critical error : cannot register mod container type %s, it has an invalid constructor"); FMLLog.log.error("Critical error : cannot register mod container type {}, it has an invalid constructor", container.getName(), e);
Throwables.propagate(e); Throwables.propagate(e);
} }
} }
@ -67,17 +67,17 @@ public class ModContainerFactory
String className = modParser.getASMType().getClassName(); String className = modParser.getASMType().getClassName();
if (modParser.isBaseMod(container.getRememberedBaseMods()) && modClass.matcher(className).find()) if (modParser.isBaseMod(container.getRememberedBaseMods()) && modClass.matcher(className).find())
{ {
FMLLog.severe("Found a BaseMod type mod %s", className); FMLLog.log.fatal("Found a BaseMod type mod {}", className);
FMLLog.severe("This will not be loaded and will be ignored. ModLoader mechanisms are no longer available."); FMLLog.log.fatal("This will not be loaded and will be ignored. ModLoader mechanisms are no longer available.");
} }
else if (modClass.matcher(className).find()) else if (modClass.matcher(className).find())
{ {
FMLLog.fine("Identified a class %s following modloader naming convention but not directly a BaseMod or currently seen subclass", className); FMLLog.log.debug("Identified a class {} following modloader naming convention but not directly a BaseMod or currently seen subclass", className);
container.rememberModCandidateType(modParser); container.rememberModCandidateType(modParser);
} }
else if (modParser.isBaseMod(container.getRememberedBaseMods())) else if (modParser.isBaseMod(container.getRememberedBaseMods()))
{ {
FMLLog.fine("Found a basemod %s of non-standard naming format", className); FMLLog.log.debug("Found a basemod {} of non-standard naming format", className);
container.rememberBaseModType(className); container.rememberBaseModType(className);
} }
@ -85,17 +85,17 @@ public class ModContainerFactory
{ {
if (modTypes.containsKey(ann.getASMType())) if (modTypes.containsKey(ann.getASMType()))
{ {
FMLLog.fine("Identified a mod of type %s (%s) - loading", ann.getASMType(), className); FMLLog.log.debug("Identified a mod of type {} ({}) - loading", ann.getASMType(), className);
try { try {
ModContainer ret = modTypes.get(ann.getASMType()).newInstance(className, container, ann.getValues()); ModContainer ret = modTypes.get(ann.getASMType()).newInstance(className, container, ann.getValues());
if (!ret.shouldLoadInEnvironment()) if (!ret.shouldLoadInEnvironment())
{ {
FMLLog.fine("Skipping mod %s, container opted to not load.", className); FMLLog.log.debug("Skipping mod {}, container opted to not load.", className);
return null; return null;
} }
return ret; return ret;
} catch (Exception e) { } catch (Exception e) {
FMLLog.log(Level.ERROR, e, "Unable to construct %s container", ann.getASMType().getClassName()); FMLLog.log.error("Unable to construct {} container", ann.getASMType().getClassName(), e);
return null; return null;
} }
} }

View File

@ -43,7 +43,7 @@ public class ObfuscationReflectionHelper
} }
catch (UnableToAccessFieldException e) catch (UnableToAccessFieldException e)
{ {
FMLLog.log(Level.ERROR, e, "There was a problem getting field index %d from %s", fieldIndex, classToAccess.getName()); FMLLog.log.error("There was a problem getting field index {} from {}", classToAccess.getName(), e);
throw e; throw e;
} }
} }
@ -68,12 +68,12 @@ public class ObfuscationReflectionHelper
} }
catch (UnableToFindFieldException e) catch (UnableToFindFieldException e)
{ {
FMLLog.log(Level.ERROR,e,"Unable to locate any field %s on type %s", Arrays.toString(fieldNames), classToAccess.getName()); FMLLog.log.error("Unable to locate any field {} on type {}", Arrays.toString(fieldNames), classToAccess.getName(), e);
throw e; throw e;
} }
catch (UnableToAccessFieldException e) catch (UnableToAccessFieldException e)
{ {
FMLLog.log(Level.ERROR, e, "Unable to access any field %s on type %s", Arrays.toString(fieldNames), classToAccess.getName()); FMLLog.log.error("Unable to access any field {} on type {}", classToAccess.getName(), e);
throw e; throw e;
} }
} }
@ -86,7 +86,7 @@ public class ObfuscationReflectionHelper
} }
catch (UnableToAccessFieldException e) catch (UnableToAccessFieldException e)
{ {
FMLLog.log(Level.ERROR, e, "There was a problem setting field index %d on type %s", fieldIndex, classToAccess.getName()); FMLLog.log.error("There was a problem setting field index {} on type {}", classToAccess.getName(), e);
throw e; throw e;
} }
} }
@ -99,12 +99,12 @@ public class ObfuscationReflectionHelper
} }
catch (UnableToFindFieldException e) catch (UnableToFindFieldException e)
{ {
FMLLog.log(Level.ERROR, e, "Unable to locate any field %s on type %s", Arrays.toString(fieldNames), classToAccess.getName()); FMLLog.log.error("Unable to locate any field {} on type {}", classToAccess.getName(), e);
throw e; throw e;
} }
catch (UnableToAccessFieldException e) catch (UnableToAccessFieldException e)
{ {
FMLLog.log(Level.ERROR, e, "Unable to set any field %s on type %s", Arrays.toString(fieldNames), classToAccess.getName()); FMLLog.log.error("Unable to set any field {} on type {}", classToAccess.getName(), e);
throw e; throw e;
} }
} }

View File

@ -71,11 +71,15 @@ public class ProgressManager
{ {
long newTime = System.nanoTime(); long newTime = System.nanoTime();
if (bar.timeEachStep) if (bar.timeEachStep)
FMLLog.fine("Bar Step: %s - %s took %.3fs", bar.getTitle(), bar.getMessage(), ((float)(newTime - bar.lastTime) / 1000000 / 1000)); {
String timeString = String.format("%.3f", ((float) (newTime - bar.lastTime) / 1000000 / 1000));
FMLLog.log.debug("Bar Step: {} - {} took {}s", bar.getTitle(), bar.getMessage(), timeString);
}
String timeString = String.format("%.3f", ((float) (newTime - bar.startTime) / 1000000 / 1000));
if (bar.getSteps() == 1) if (bar.getSteps() == 1)
FMLLog.fine("Bar Finished: %s - %s took %.3fs", bar.getTitle(), bar.getMessage(), ((float)(newTime - bar.startTime) / 1000000 / 1000)); FMLLog.log.debug("Bar Finished: {} - {} took {}s", bar.getTitle(), bar.getMessage(), timeString);
else else
FMLLog.fine("Bar Finished: %s took %.3fs", bar.getTitle(), ((float)(newTime - bar.startTime) / 1000000 / 1000)); FMLLog.log.debug("Bar Finished: {} took {}s", bar.getTitle(), timeString);
} }
FMLCommonHandler.instance().processWindowMessages(); FMLCommonHandler.instance().processWindowMessages();
} }
@ -120,7 +124,7 @@ public class ProgressManager
if (timeEachStep && step != 0) if (timeEachStep && step != 0)
{ {
long newTime = System.nanoTime(); long newTime = System.nanoTime();
FMLLog.fine("Bar Step: %s - %s took %.3fs", getTitle(), getMessage(), ((float)(newTime - lastTime) / 1000000 / 1000)); FMLLog.log.debug(String.format("Bar Step: %s - %s took %.3fs", getTitle(), getMessage(), ((float)(newTime - lastTime) / 1000000 / 1000)));
lastTime = newTime; lastTime = newTime;
} }
step++; step++;

View File

@ -40,7 +40,7 @@ public class ProxyInjector
{ {
public static void inject(ModContainer mod, ASMDataTable data, Side side, ILanguageAdapter languageAdapter) public static void inject(ModContainer mod, ASMDataTable data, Side side, ILanguageAdapter languageAdapter)
{ {
FMLLog.fine("Attempting to inject @SidedProxy classes into %s", mod.getModId()); FMLLog.log.debug("Attempting to inject @SidedProxy classes into {}", mod.getModId());
SetMultimap<String, ASMData> modData = data.getAnnotationsFor(mod); SetMultimap<String, ASMData> modData = data.getAnnotationsFor(mod);
Set<ASMData> mods = modData.get(Mod.class.getName()); Set<ASMData> mods = modData.get(Mod.class.getName());
Set<ASMData> targets = modData.get(SidedProxy.class.getName()); Set<ASMData> targets = modData.get(SidedProxy.class.getName());
@ -56,13 +56,13 @@ public class ProxyInjector
amodid = ASMDataTable.getOwnerModID(mods, targ); amodid = ASMDataTable.getOwnerModID(mods, targ);
if (Strings.isNullOrEmpty(amodid)) if (Strings.isNullOrEmpty(amodid))
{ {
FMLLog.bigWarning("Could not determine owning mod for @SidedProxy on %s for mod %s", targ.getClassName(), mod.getModId()); FMLLog.bigWarning("Could not determine owning mod for @SidedProxy on {} for mod {}", targ.getClassName(), mod.getModId());
continue; continue;
} }
} }
if (!mod.getModId().equals(amodid)) if (!mod.getModId().equals(amodid))
{ {
FMLLog.fine("Skipping proxy injection for %s.%s since it is not for mod %s", targ.getClassName(), targ.getObjectName(), mod.getModId()); FMLLog.log.debug("Skipping proxy injection for {}.{} since it is not for mod {}", targ.getClassName(), targ.getObjectName(), mod.getModId());
continue; continue;
} }
@ -71,7 +71,7 @@ public class ProxyInjector
if (target == null) if (target == null)
{ {
// Impossible? // Impossible?
FMLLog.severe("Attempted to load a proxy type into %s.%s but the field was not found", targ.getClassName(), targ.getObjectName()); FMLLog.log.fatal("Attempted to load a proxy type into {}.{} but the field was not found", targ.getClassName(), targ.getObjectName());
throw new LoaderException(String.format("Attempted to load a proxy type into %s.%s but the field was not found", targ.getClassName(), targ.getObjectName())); throw new LoaderException(String.format("Attempted to load a proxy type into %s.%s but the field was not found", targ.getClassName(), targ.getObjectName()));
} }
target.setAccessible(true); target.setAccessible(true);
@ -86,19 +86,19 @@ public class ProxyInjector
if (languageAdapter.supportsStatics() && (target.getModifiers() & Modifier.STATIC) == 0 ) if (languageAdapter.supportsStatics() && (target.getModifiers() & Modifier.STATIC) == 0 )
{ {
FMLLog.severe("Attempted to load a proxy type %s into %s.%s, but the field is not static", targetType, targ.getClassName(), targ.getObjectName()); FMLLog.log.fatal("Attempted to load a proxy type {} into {}.{}, but the field is not static", targetType, targ.getClassName(), targ.getObjectName());
throw new LoaderException(String.format("Attempted to load a proxy type %s into %s.%s, but the field is not static", targetType, targ.getClassName(), targ.getObjectName())); throw new LoaderException(String.format("Attempted to load a proxy type %s into %s.%s, but the field is not static", targetType, targ.getClassName(), targ.getObjectName()));
} }
if (!target.getType().isAssignableFrom(proxy.getClass())) if (!target.getType().isAssignableFrom(proxy.getClass()))
{ {
FMLLog.severe("Attempted to load a proxy type %s into %s.%s, but the types don't match", targetType, targ.getClassName(), targ.getObjectName()); FMLLog.log.fatal("Attempted to load a proxy type {} into {}.{}, but the types don't match", targetType, targ.getClassName(), targ.getObjectName());
throw new LoaderException(String.format("Attempted to load a proxy type %s into %s.%s, but the types don't match", targetType, targ.getClassName(), targ.getObjectName())); throw new LoaderException(String.format("Attempted to load a proxy type %s into %s.%s, but the types don't match", targetType, targ.getClassName(), targ.getObjectName()));
} }
languageAdapter.setProxy(target, proxyTarget, proxy); languageAdapter.setProxy(target, proxyTarget, proxy);
} }
catch (Exception e) catch (Exception e)
{ {
FMLLog.log(Level.ERROR, e, "An error occurred trying to load a proxy into %s.%s", targ.getAnnotationInfo(), targ.getClassName(), targ.getObjectName()); FMLLog.log.error("An error occurred trying to load a proxy into {}.{}", targ.getObjectName(), e);
throw new LoaderException(e); throw new LoaderException(e);
} }
} }

View File

@ -68,7 +68,7 @@ public class StartupQuery {
} }
catch (InterruptedException e) catch (InterruptedException e)
{ {
FMLLog.warning("query interrupted"); FMLLog.log.warn("query interrupted");
abort(); abort();
} }
@ -120,7 +120,7 @@ public class StartupQuery {
if (result != null && prop != null) if (result != null && prop != null)
{ {
FMLLog.info("Using fml.queryResult %s to answer the following query:\n%s", prop, text); FMLLog.log.info("Using fml.queryResult {} to answer the following query:\n{}", prop, text);
if (prop.equalsIgnoreCase("confirm")) if (prop.equalsIgnoreCase("confirm"))
{ {
@ -133,7 +133,7 @@ public class StartupQuery {
return; return;
} }
FMLLog.warning("Invalid value for fml.queryResult: %s, expected confirm or cancel", prop); FMLLog.log.warn("Invalid value for fml.queryResult: {}, expected confirm or cancel", prop);
} }
synchronous = false; synchronous = false;
@ -156,7 +156,7 @@ public class StartupQuery {
} }
catch (InterruptedException e) catch (InterruptedException e)
{ {
FMLLog.warning("query interrupted"); FMLLog.log.warn("query interrupted");
abort(); abort();
} }
} }

View File

@ -40,12 +40,12 @@ public class TracingPrintStream extends PrintStream {
@Override @Override
public void println(Object o) { public void println(Object o) {
logger.info(getPrefix() + o); logger.info("{}{}", getPrefix(), o);
} }
@Override @Override
public void println(String s) { public void println(String s) {
logger.info(getPrefix() + s); logger.info("{}{}", getPrefix(), s);
} }
private String getPrefix() { private String getPrefix() {

View File

@ -102,10 +102,10 @@ public class ZipperUtil {
} }
catch (IOException e) catch (IOException e)
{ {
FMLLog.log(Level.WARN, e, "World backup failed."); FMLLog.log.warn("World backup failed.", e);
throw e; throw e;
} }
FMLLog.info("World backup created at %s.", zip.getCanonicalPath()); FMLLog.log.info("World backup created at {}.", zip.getCanonicalPath());
} }
} }

View File

@ -30,7 +30,6 @@ import java.util.jar.JarFile;
import net.minecraftforge.common.util.Java6Utils; import net.minecraftforge.common.util.Java6Utils;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.logging.log4j.Level;
import net.minecraft.launchwrapper.LaunchClassLoader; import net.minecraft.launchwrapper.LaunchClassLoader;
import net.minecraftforge.fml.common.CertificateHelper; import net.minecraftforge.fml.common.CertificateHelper;
@ -38,13 +37,14 @@ import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper; import net.minecraftforge.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper;
import net.minecraftforge.fml.common.patcher.ClassPatchManager; import net.minecraftforge.fml.common.patcher.ClassPatchManager;
import net.minecraftforge.fml.relauncher.FMLLaunchHandler; import net.minecraftforge.fml.relauncher.FMLLaunchHandler;
import net.minecraftforge.fml.relauncher.FMLRelaunchLog;
import net.minecraftforge.fml.relauncher.IFMLCallHook; import net.minecraftforge.fml.relauncher.IFMLCallHook;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import com.google.common.base.Charsets; import com.google.common.base.Charsets;
import com.google.common.io.ByteStreams; import com.google.common.io.ByteStreams;
import static net.minecraftforge.fml.common.FMLLog.log;
public class FMLSanityChecker implements IFMLCallHook public class FMLSanityChecker implements IFMLCallHook
{ {
private static final String FMLFINGERPRINT = "51:0A:FB:4C:AF:A4:A0:F2:F5:CF:C5:0E:B4:CC:3C:30:24:4A:E3:8E".toLowerCase().replace(":", ""); private static final String FMLFINGERPRINT = "51:0A:FB:4C:AF:A4:A0:F2:F5:CF:C5:0E:B4:CC:3C:30:24:4A:E3:8E".toLowerCase().replace(":", "");
@ -72,17 +72,17 @@ public class FMLSanityChecker implements IFMLCallHook
String fingerprint = CertificateHelper.getFingerprint(cert); String fingerprint = CertificateHelper.getFingerprint(cert);
if (fingerprint.equals(FMLFINGERPRINT)) if (fingerprint.equals(FMLFINGERPRINT))
{ {
FMLRelaunchLog.info("Found valid fingerprint for FML. Certificate fingerprint %s", fingerprint); log.info("Found valid fingerprint for FML. Certificate fingerprint {}", fingerprint);
goodFML = true; goodFML = true;
} }
else if (fingerprint.equals(FORGEFINGERPRINT)) else if (fingerprint.equals(FORGEFINGERPRINT))
{ {
FMLRelaunchLog.info("Found valid fingerprint for Minecraft Forge. Certificate fingerprint %s", fingerprint); log.info("Found valid fingerprint for Minecraft Forge. Certificate fingerprint {}", fingerprint);
goodFML = true; goodFML = true;
} }
else else
{ {
FMLRelaunchLog.severe("Found invalid fingerprint for FML: %s", fingerprint); log.error("Found invalid fingerprint for FML: {}", fingerprint);
} }
} }
} }
@ -134,7 +134,7 @@ public class FMLSanityChecker implements IFMLCallHook
String fingerprint = CertificateHelper.getFingerprint(cert); String fingerprint = CertificateHelper.getFingerprint(cert);
if (fingerprint.equals(MCFINGERPRINT)) if (fingerprint.equals(MCFINGERPRINT))
{ {
FMLRelaunchLog.info("Found valid fingerprint for Minecraft. Certificate fingerprint %s", fingerprint); log.info("Found valid fingerprint for Minecraft. Certificate fingerprint {}", fingerprint);
goodMC = true; goodMC = true;
} }
} }
@ -142,7 +142,7 @@ public class FMLSanityChecker implements IFMLCallHook
} }
catch (Throwable e) catch (Throwable e)
{ {
FMLRelaunchLog.log(Level.ERROR, e, "A critical error occurred trying to read the minecraft jar file"); log.error("A critical error occurred trying to read the minecraft jar file", e);
} }
finally finally
{ {
@ -155,11 +155,11 @@ public class FMLSanityChecker implements IFMLCallHook
} }
if (!goodMC) if (!goodMC)
{ {
FMLRelaunchLog.severe("The minecraft jar %s appears to be corrupt! There has been CRITICAL TAMPERING WITH MINECRAFT, it is highly unlikely minecraft will work! STOP NOW, get a clean copy and try again!",codeSource.getLocation().getFile()); log.error("The minecraft jar {} appears to be corrupt! There has been CRITICAL TAMPERING WITH MINECRAFT, it is highly unlikely minecraft will work! STOP NOW, get a clean copy and try again!", codeSource.getLocation().getFile());
if (!Boolean.parseBoolean(System.getProperty("fml.ignoreInvalidMinecraftCertificates","false"))) if (!Boolean.parseBoolean(System.getProperty("fml.ignoreInvalidMinecraftCertificates","false")))
{ {
FMLRelaunchLog.severe("For your safety, FML will not launch minecraft. You will need to fetch a clean version of the minecraft jar file"); log.error("For your safety, FML will not launch minecraft. You will need to fetch a clean version of the minecraft jar file");
FMLRelaunchLog.severe("Technical information: The class net.minecraft.client.ClientBrandRetriever should have been associated with the minecraft jar file, " + log.error("Technical information: The class net.minecraft.client.ClientBrandRetriever should have been associated with the minecraft jar file, " +
"and should have returned us a valid, intact minecraft jar location. This did not work. Either you have modified the minecraft jar file (if so " + "and should have returned us a valid, intact minecraft jar location. This did not work. Either you have modified the minecraft jar file (if so " +
"run the forge installer again), or you are using a base editing jar that is changing this class (and likely others too). If you REALLY " + "run the forge installer again), or you are using a base editing jar that is changing this class (and likely others too). If you REALLY " +
"want to run minecraft in this configuration, add the flag -Dfml.ignoreInvalidMinecraftCertificates=true to the 'JVM settings' in your launcher profile."); "want to run minecraft in this configuration, add the flag -Dfml.ignoreInvalidMinecraftCertificates=true to the 'JVM settings' in your launcher profile.");
@ -167,13 +167,13 @@ public class FMLSanityChecker implements IFMLCallHook
} }
else else
{ {
FMLRelaunchLog.severe("FML has been ordered to ignore the invalid or missing minecraft certificate. This is very likely to cause a problem!"); log.error("FML has been ordered to ignore the invalid or missing minecraft certificate. This is very likely to cause a problem!");
FMLRelaunchLog.severe("Technical information: ClientBrandRetriever was at %s, there were %d certificates for it", codeSource.getLocation(), certCount); log.error("Technical information: ClientBrandRetriever was at {}, there were {} certificates for it", codeSource.getLocation(), certCount);
} }
} }
if (!goodFML) if (!goodFML)
{ {
FMLRelaunchLog.severe("FML appears to be missing any signature data. This is not a good thing"); log.error("FML appears to be missing any signature data. This is not a good thing");
} }
return null; return null;
} }

View File

@ -19,6 +19,7 @@
package net.minecraftforge.fml.common.asm.transformers; package net.minecraftforge.fml.common.asm.transformers;
import net.minecraftforge.fml.common.FMLLog;
import static org.objectweb.asm.Opcodes.ACC_FINAL; import static org.objectweb.asm.Opcodes.ACC_FINAL;
import static org.objectweb.asm.Opcodes.ACC_PRIVATE; import static org.objectweb.asm.Opcodes.ACC_PRIVATE;
import static org.objectweb.asm.Opcodes.ACC_PROTECTED; import static org.objectweb.asm.Opcodes.ACC_PROTECTED;
@ -43,7 +44,6 @@ import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream; import java.util.zip.ZipOutputStream;
import net.minecraft.launchwrapper.IClassTransformer; import net.minecraft.launchwrapper.IClassTransformer;
import net.minecraftforge.fml.relauncher.FMLRelaunchLog;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassReader;
@ -125,7 +125,7 @@ public class AccessTransformer implements IClassTransformer
rulesResource = Resources.getResource(rulesFile); rulesResource = Resources.getResource(rulesFile);
} }
processATFile(Resources.asCharSource(rulesResource, Charsets.UTF_8)); processATFile(Resources.asCharSource(rulesResource, Charsets.UTF_8));
FMLRelaunchLog.fine("Loaded %d rules from AccessTransformer config file %s", modifiers.size(), rulesFile); FMLLog.log.debug("Loaded {} rules from AccessTransformer config file {}", modifiers.size(), rulesFile);
} }
protected void processATFile(CharSource rulesResource) throws IOException protected void processATFile(CharSource rulesResource) throws IOException
{ {
@ -173,7 +173,7 @@ public class AccessTransformer implements IClassTransformer
} }
String className = parts.get(1).replace('/', '.'); String className = parts.get(1).replace('/', '.');
modifiers.put(className, m); modifiers.put(className, m);
if (DEBUG) FMLRelaunchLog.fine("AT RULE: %s %s %s (type %s)", toBinary(m.targetAccess), m.name, m.desc, className); if (DEBUG) FMLLog.log.debug("AT RULE: {} {} {} (type {})", toBinary(m.targetAccess), m.name, m.desc, className);
return true; return true;
} }
}); });
@ -187,7 +187,7 @@ public class AccessTransformer implements IClassTransformer
if (DEBUG) if (DEBUG)
{ {
FMLRelaunchLog.fine("Considering all methods and fields on %s (%s)", transformedName, name); FMLLog.log.debug("Considering all methods and fields on {} ({})", transformedName, name);
} }
ClassNode classNode = new ClassNode(); ClassNode classNode = new ClassNode();
@ -202,7 +202,7 @@ public class AccessTransformer implements IClassTransformer
classNode.access = getFixedAccess(classNode.access, m); classNode.access = getFixedAccess(classNode.access, m);
if (DEBUG) if (DEBUG)
{ {
FMLRelaunchLog.fine("Class: %s %s -> %s", name, toBinary(m.oldAccess), toBinary(m.newAccess)); FMLLog.log.debug("Class: {} {} -> {}", name, toBinary(m.oldAccess), toBinary(m.newAccess));
} }
continue; continue;
} }
@ -215,7 +215,7 @@ public class AccessTransformer implements IClassTransformer
n.access = getFixedAccess(n.access, m); n.access = getFixedAccess(n.access, m);
if (DEBUG) if (DEBUG)
{ {
FMLRelaunchLog.fine("Field: %s.%s %s -> %s", name, n.name, toBinary(m.oldAccess), toBinary(m.newAccess)); FMLLog.log.debug("Field: {}.{} {} -> {}", name, n.name, toBinary(m.oldAccess), toBinary(m.newAccess));
} }
if (!m.name.equals("*")) if (!m.name.equals("*"))
@ -251,7 +251,7 @@ public class AccessTransformer implements IClassTransformer
if (DEBUG) if (DEBUG)
{ {
FMLRelaunchLog.fine("Method: %s.%s%s %s -> %s", name, n.name, n.desc, toBinary(m.oldAccess), toBinary(m.newAccess)); FMLLog.log.debug("Method: {}.{}{} {} -> {}", name, n.name, n.desc, toBinary(m.oldAccess), toBinary(m.newAccess));
} }
if (!m.name.equals("*")) if (!m.name.equals("*"))

View File

@ -58,7 +58,7 @@ public class BlamingTransformer implements IClassTransformer
{ {
naughtyClasses.add(cls); naughtyClasses.add(cls);
naughtyMods.add(modId); naughtyMods.add(modId);
FMLLog.severe("Unsupported class format in mod %s: class %s", modId, cls); FMLLog.log.fatal("Unsupported class format in mod {}: class {}", modId, cls);
} }
public static class VersionVisitor extends ClassVisitor public static class VersionVisitor extends ClassVisitor

View File

@ -26,11 +26,11 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import net.minecraft.launchwrapper.IClassTransformer; import net.minecraft.launchwrapper.IClassTransformer;
import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.ModAPIManager; import net.minecraftforge.fml.common.ModAPIManager;
import net.minecraftforge.fml.common.discovery.ASMDataTable; import net.minecraftforge.fml.common.discovery.ASMDataTable;
import net.minecraftforge.fml.common.discovery.ASMDataTable.ASMData; import net.minecraftforge.fml.common.discovery.ASMDataTable.ASMData;
import net.minecraftforge.fml.relauncher.FMLRelaunchLog;
import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassWriter; import org.objectweb.asm.ClassWriter;
@ -64,17 +64,17 @@ public class ModAPITransformer implements IClassTransformer {
ClassReader classReader = new ClassReader(basicClass); ClassReader classReader = new ClassReader(basicClass);
classReader.accept(classNode, 0); classReader.accept(classNode, 0);
if (logDebugInfo) FMLRelaunchLog.finer("Optional removal - found optionals for class %s - processing", name); if (logDebugInfo) FMLLog.log.trace("Optional removal - found optionals for class {} - processing", name);
for (ASMData optional : optionals.get(lookupName)) for (ASMData optional : optionals.get(lookupName))
{ {
String modId = (String) optional.getAnnotationInfo().get("modid"); String modId = (String) optional.getAnnotationInfo().get("modid");
if (Loader.isModLoaded(modId) || ModAPIManager.INSTANCE.hasAPI(modId)) if (Loader.isModLoaded(modId) || ModAPIManager.INSTANCE.hasAPI(modId))
{ {
if (logDebugInfo) FMLRelaunchLog.finer("Optional removal skipped - mod present %s", modId); if (logDebugInfo) FMLLog.log.trace("Optional removal skipped - mod present {}", modId);
continue; continue;
} }
if (logDebugInfo) FMLRelaunchLog.finer("Optional on %s triggered - mod missing %s", name, modId); if (logDebugInfo) FMLLog.log.trace("Optional on {} triggered - mod missing {}", name, modId);
if (optional.getAnnotationInfo().containsKey("iface")) if (optional.getAnnotationInfo().containsKey("iface"))
{ {
@ -88,7 +88,7 @@ public class ModAPITransformer implements IClassTransformer {
} }
} }
if (logDebugInfo) FMLRelaunchLog.finer("Optional removal - class %s processed", name); if (logDebugInfo) FMLLog.log.trace("Optional removal - class {} processed", name);
ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS); ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS);
classNode.accept(writer); classNode.accept(writer);
@ -109,11 +109,11 @@ public class ModAPITransformer implements IClassTransformer {
if (methodDescriptor.equals(method.name+method.desc)) if (methodDescriptor.equals(method.name+method.desc))
{ {
iterator.remove(); iterator.remove();
if (logDebugInfo) FMLRelaunchLog.finer("Optional removal - method %s removed", methodDescriptor); if (logDebugInfo) FMLLog.log.debug("Optional removal - method {} removed", methodDescriptor);
return; return;
} }
} }
if (logDebugInfo) FMLRelaunchLog.finer("Optional removal - method %s NOT removed - not found", methodDescriptor); if (logDebugInfo) FMLLog.log.debug("Optional removal - method {} NOT removed - not found", methodDescriptor);
} }
private void stripInterface(ClassNode classNode, String interfaceName, boolean stripRefs) private void stripInterface(ClassNode classNode, String interfaceName, boolean stripRefs)
@ -126,28 +126,28 @@ public class ModAPITransformer implements IClassTransformer {
final RemovingSignatureWriter signatureWriter = new RemovingSignatureWriter(ifaceName); final RemovingSignatureWriter signatureWriter = new RemovingSignatureWriter(ifaceName);
sr.accept(signatureWriter); sr.accept(signatureWriter);
classNode.signature = signatureWriter.toString(); classNode.signature = signatureWriter.toString();
if (logDebugInfo) FMLRelaunchLog.finer("Optional removal - interface %s removed from type signature"); if (logDebugInfo) FMLLog.log.debug("Optional removal - interface {} removed from type signature", interfaceName);
} }
if (found && logDebugInfo) FMLRelaunchLog.finer("Optional removal - interface %s removed", interfaceName); if (found && logDebugInfo) FMLLog.log.debug("Optional removal - interface {} removed", interfaceName);
if (!found && logDebugInfo) FMLRelaunchLog.finer("Optional removal - interface %s NOT removed - not found", interfaceName); if (!found && logDebugInfo) FMLLog.log.debug("Optional removal - interface {} NOT removed - not found", interfaceName);
if (found && stripRefs) if (found && stripRefs)
{ {
if (logDebugInfo) FMLRelaunchLog.finer("Optional removal - interface %s - stripping method signature references", interfaceName); if (logDebugInfo) FMLLog.log.debug("Optional removal - interface {} - stripping method signature references", interfaceName);
for (Iterator<MethodNode> iterator = classNode.methods.iterator(); iterator.hasNext();) for (Iterator<MethodNode> iterator = classNode.methods.iterator(); iterator.hasNext();)
{ {
MethodNode node = iterator.next(); MethodNode node = iterator.next();
if (node.desc.contains(ifaceName)) if (node.desc.contains(ifaceName))
{ {
if (logDebugInfo) FMLRelaunchLog.finer("Optional removal - interface %s - stripping method containing reference %s", interfaceName, node.name); if (logDebugInfo) FMLLog.log.debug("Optional removal - interface {} - stripping method containing reference {}", interfaceName, node.name);
iterator.remove(); iterator.remove();
} }
} }
if (logDebugInfo) FMLRelaunchLog.finer("Optional removal - interface %s - all method signature references stripped", interfaceName); if (logDebugInfo) FMLLog.log.debug("Optional removal - interface {} - all method signature references stripped", interfaceName);
} }
else if (found) else if (found)
{ {
if (logDebugInfo) FMLRelaunchLog.finer("Optional removal - interface %s - NOT stripping method signature references", interfaceName); if (logDebugInfo) FMLLog.log.debug("Optional removal - interface {} - NOT stripping method signature references", interfaceName);
} }
} }

View File

@ -27,7 +27,7 @@ import java.util.jar.JarEntry;
import java.util.jar.JarFile; import java.util.jar.JarFile;
import java.util.jar.Manifest; import java.util.jar.Manifest;
import net.minecraftforge.fml.relauncher.FMLRelaunchLog; import net.minecraftforge.fml.common.FMLLog;
import com.google.common.base.Charsets; import com.google.common.base.Charsets;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
@ -54,7 +54,7 @@ public class ModAccessTransformer extends AccessTransformer {
int added = getModifiers().size() - old_count; int added = getModifiers().size() - old_count;
if (added > 0) if (added > 0)
{ {
FMLRelaunchLog.fine("Loaded %d rules from AccessTransformer mod jar file %s\n", added, e.getKey()); FMLLog.log.debug("Loaded {} rules from AccessTransformer mod jar file {}\n", added, e.getKey());
} }
} }
} }

View File

@ -22,7 +22,7 @@ package net.minecraftforge.fml.common.asm.transformers;
import org.objectweb.asm.*; import org.objectweb.asm.*;
import net.minecraft.launchwrapper.IClassTransformer; import net.minecraft.launchwrapper.IClassTransformer;
import net.minecraftforge.fml.relauncher.FMLRelaunchLog; import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.relauncher.FMLSecurityManager.ExitTrappedException; import net.minecraftforge.fml.relauncher.FMLSecurityManager.ExitTrappedException;
public class TerminalTransformer implements IClassTransformer public class TerminalTransformer implements IClassTransformer
@ -81,11 +81,11 @@ public class TerminalTransformer implements IClassTransformer
{ {
if (warn) if (warn)
{ {
FMLRelaunchLog.warning("============================================================="); FMLLog.log.warn("=============================================================");
FMLRelaunchLog.warning("MOD HAS DIRECT REFERENCE System.exit() THIS IS NOT ALLOWED REROUTING TO FML!"); FMLLog.log.warn("MOD HAS DIRECT REFERENCE System.exit() THIS IS NOT ALLOWED REROUTING TO FML!");
FMLRelaunchLog.warning("Offender: %s.%s%s", ExitVisitor.this.clsName, mName, mDesc); FMLLog.log.warn("Offender: {}.{}{}", ExitVisitor.this.clsName, mName, mDesc);
FMLRelaunchLog.warning("Use FMLCommonHandler.exitJava instead"); FMLLog.log.warn("Use FMLCommonHandler.exitJava instead");
FMLRelaunchLog.warning("============================================================="); FMLLog.log.warn("=============================================================");
} }
owner = ExitVisitor.callbackOwner; owner = ExitVisitor.callbackOwner;
name = "systemExitCalled"; name = "systemExitCalled";
@ -94,11 +94,11 @@ public class TerminalTransformer implements IClassTransformer
{ {
if (warn) if (warn)
{ {
FMLRelaunchLog.warning("============================================================="); FMLLog.log.warn("=============================================================");
FMLRelaunchLog.warning("MOD HAS DIRECT REFERENCE Runtime.exit() THIS IS NOT ALLOWED REROUTING TO FML!"); FMLLog.log.warn("MOD HAS DIRECT REFERENCE Runtime.exit() THIS IS NOT ALLOWED REROUTING TO FML!");
FMLRelaunchLog.warning("Offender: %s.%s%s", ExitVisitor.this.clsName, mName, mDesc); FMLLog.log.warn("Offender: {}.{}{}", ExitVisitor.this.clsName, mName, mDesc);
FMLRelaunchLog.warning("Use FMLCommonHandler.exitJava instead"); FMLLog.log.warn("Use FMLCommonHandler.exitJava instead");
FMLRelaunchLog.warning("============================================================="); FMLLog.log.warn("=============================================================");
} }
opcode = Opcodes.INVOKESTATIC; opcode = Opcodes.INVOKESTATIC;
owner = ExitVisitor.callbackOwner; owner = ExitVisitor.callbackOwner;
@ -109,11 +109,11 @@ public class TerminalTransformer implements IClassTransformer
{ {
if (warn) if (warn)
{ {
FMLRelaunchLog.warning("============================================================="); FMLLog.log.warn("=============================================================");
FMLRelaunchLog.warning("MOD HAS DIRECT REFERENCE Runtime.halt() THIS IS NOT ALLOWED REROUTING TO FML!"); FMLLog.log.warn("MOD HAS DIRECT REFERENCE Runtime.halt() THIS IS NOT ALLOWED REROUTING TO FML!");
FMLRelaunchLog.warning("Offendor: %s.%s%s", ExitVisitor.this.clsName, mName, mDesc); FMLLog.log.warn("Offendor: {}.{}{}", ExitVisitor.this.clsName, mName, mDesc);
FMLRelaunchLog.warning("Use FMLCommonHandler.exitJava instead"); FMLLog.log.warn("Use FMLCommonHandler.exitJava instead");
FMLRelaunchLog.warning("============================================================="); FMLLog.log.warn("=============================================================");
} }
opcode = Opcodes.INVOKESTATIC; opcode = Opcodes.INVOKESTATIC;
owner = ExitVisitor.callbackOwner; owner = ExitVisitor.callbackOwner;

View File

@ -29,10 +29,10 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import net.minecraft.launchwrapper.LaunchClassLoader; import net.minecraft.launchwrapper.LaunchClassLoader;
import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.patcher.ClassPatchManager; import net.minecraftforge.fml.common.patcher.ClassPatchManager;
import net.minecraftforge.fml.relauncher.FMLRelaunchLog;
import org.apache.logging.log4j.Level; import org.apache.logging.log4j.message.Message;
import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassReader;
import org.objectweb.asm.commons.Remapper; import org.objectweb.asm.commons.Remapper;
import org.objectweb.asm.tree.ClassNode; import org.objectweb.asm.tree.ClassNode;
@ -112,7 +112,7 @@ public class FMLDeobfuscatingRemapper extends Remapper {
} }
catch (IOException ioe) catch (IOException ioe)
{ {
FMLRelaunchLog.log(Level.ERROR, "An error occurred loading the deobfuscation map data", ioe); FMLLog.log.error("An error occurred loading the deobfuscation map data", ioe);
} }
methodNameMaps = Maps.newHashMapWithExpectedSize(rawMethodMaps.size()); methodNameMaps = Maps.newHashMapWithExpectedSize(rawMethodMaps.size());
fieldNameMaps = Maps.newHashMapWithExpectedSize(rawFieldMaps.size()); fieldNameMaps = Maps.newHashMapWithExpectedSize(rawFieldMaps.size());
@ -133,12 +133,12 @@ public class FMLDeobfuscatingRemapper extends Remapper {
LZMAInputSupplier zis = new LZMAInputSupplier(classData); LZMAInputSupplier zis = new LZMAInputSupplier(classData);
CharSource srgSource = zis.asCharSource(Charsets.UTF_8); CharSource srgSource = zis.asCharSource(Charsets.UTF_8);
srgList = srgSource.readLines(); srgList = srgSource.readLines();
FMLRelaunchLog.fine("Loading deobfuscation resource %s with %d records", deobfFileName, srgList.size()); FMLLog.log.debug("Loading deobfuscation resource {} with {} records", deobfFileName, srgList.size());
} }
else else
{ {
srgList = Files.readLines(new File(gradleStartProp), Charsets.UTF_8); srgList = Files.readLines(new File(gradleStartProp), Charsets.UTF_8);
FMLRelaunchLog.fine("Loading deobfuscation resource %s with %d records", gradleStartProp, srgList.size()); FMLLog.log.debug("Loading deobfuscation resource {} with {} records", gradleStartProp, srgList.size());
} }
rawMethodMaps = Maps.newHashMap(); rawMethodMaps = Maps.newHashMap();
@ -166,7 +166,7 @@ public class FMLDeobfuscatingRemapper extends Remapper {
} }
catch (IOException ioe) catch (IOException ioe)
{ {
FMLRelaunchLog.log(Level.ERROR, ioe, "An error occurred loading the deobfuscation map data"); FMLLog.log.error("An error occurred loading the deobfuscation map data", ioe);
} }
methodNameMaps = Maps.newHashMapWithExpectedSize(rawMethodMaps.size()); methodNameMaps = Maps.newHashMapWithExpectedSize(rawMethodMaps.size());
fieldNameMaps = Maps.newHashMapWithExpectedSize(rawFieldMaps.size()); fieldNameMaps = Maps.newHashMapWithExpectedSize(rawFieldMaps.size());
@ -234,7 +234,7 @@ public class FMLDeobfuscatingRemapper extends Remapper {
} }
catch (IOException e) catch (IOException e)
{ {
FMLRelaunchLog.log(Level.ERROR,e, "A critical exception occurred reading a class file %s", owner); FMLLog.log.error("A critical exception occurred reading a class file {}", owner, e);
} }
return null; return null;
} }
@ -390,7 +390,7 @@ public class FMLDeobfuscatingRemapper extends Remapper {
if (DUMP_FIELD_MAPS) if (DUMP_FIELD_MAPS)
{ {
FMLRelaunchLog.finer("Field map for %s : %s", className, fieldNameMaps.get(className)); FMLLog.log.trace("Field map for {} : {}", className, fieldNameMaps.get(className));
} }
} }
return fieldNameMaps.get(className); return fieldNameMaps.get(className);
@ -407,7 +407,7 @@ public class FMLDeobfuscatingRemapper extends Remapper {
} }
if (DUMP_METHOD_MAPS) if (DUMP_METHOD_MAPS)
{ {
FMLRelaunchLog.finer("Method map for %s : %s", className, methodNameMaps.get(className)); FMLLog.log.trace("Method map for {} : {}", className, methodNameMaps.get(className));
} }
} }

View File

@ -59,7 +59,7 @@ public class DirectoryDiscoverer implements ITypeDiscoverer
{ {
this.table = table; this.table = table;
List<ModContainer> found = Lists.newArrayList(); List<ModContainer> found = Lists.newArrayList();
FMLLog.fine("Examining directory %s for potential mods", candidate.getModContainer().getName()); FMLLog.log.debug("Examining directory {} for potential mods", candidate.getModContainer().getName());
exploreFileSystem("", candidate.getModContainer(), found, candidate, null); exploreFileSystem("", candidate.getModContainer(), found, candidate, null);
for (ModContainer mc : found) for (ModContainer mc : found)
{ {
@ -84,12 +84,12 @@ public class DirectoryDiscoverer implements ITypeDiscoverer
{ {
IOUtils.closeQuietly(fis); IOUtils.closeQuietly(fis);
} }
FMLLog.fine("Found an mcmod.info file in directory %s", modDir.getName()); FMLLog.log.debug("Found an mcmod.info file in directory {}", modDir.getName());
} }
catch (Exception e) catch (Exception e)
{ {
mc = MetadataCollection.from(null,""); mc = MetadataCollection.from(null,"");
FMLLog.fine("No mcmod.info file found in directory %s", modDir.getName()); FMLLog.log.debug("No mcmod.info file found in directory {}", modDir.getName());
} }
} }
@ -101,7 +101,7 @@ public class DirectoryDiscoverer implements ITypeDiscoverer
{ {
if (file.isDirectory()) if (file.isDirectory())
{ {
FMLLog.finer("Recursing into package %s", path + file.getName()); FMLLog.log.trace("Recursing into package {}", path + file.getName());
exploreFileSystem(path + file.getName() + "/", file, harvestedMods, candidate, mc); exploreFileSystem(path + file.getName() + "/", file, harvestedMods, candidate, mc);
continue; continue;
} }
@ -119,7 +119,7 @@ public class DirectoryDiscoverer implements ITypeDiscoverer
} }
catch (LoaderException e) catch (LoaderException e)
{ {
FMLLog.log(Level.ERROR, e, "There was a problem reading the file %s - probably this is a corrupt file", file.getPath()); FMLLog.log.error("There was a problem reading the file {} - probably this is a corrupt file", file.getPath(), e);
throw e; throw e;
} }
catch (Exception e) catch (Exception e)

View File

@ -46,7 +46,7 @@ public class JarDiscoverer implements ITypeDiscoverer
public List<ModContainer> discover(ModCandidate candidate, ASMDataTable table) public List<ModContainer> discover(ModCandidate candidate, ASMDataTable table)
{ {
List<ModContainer> foundMods = Lists.newArrayList(); List<ModContainer> foundMods = Lists.newArrayList();
FMLLog.fine("Examining file %s for potential mods", candidate.getModContainer().getName()); FMLLog.log.debug("Examining file {} for potential mods", candidate.getModContainer().getName());
JarFile jar = null; JarFile jar = null;
try try
{ {
@ -56,7 +56,7 @@ public class JarDiscoverer implements ITypeDiscoverer
MetadataCollection mc = null; MetadataCollection mc = null;
if (modInfo != null) if (modInfo != null)
{ {
FMLLog.finer("Located mcmod.info file in file %s", candidate.getModContainer().getName()); FMLLog.log.trace("Located mcmod.info file in file {}", candidate.getModContainer().getName());
InputStream inputStream = jar.getInputStream(modInfo); InputStream inputStream = jar.getInputStream(modInfo);
try try
{ {
@ -69,7 +69,7 @@ public class JarDiscoverer implements ITypeDiscoverer
} }
else else
{ {
FMLLog.fine("The mod container %s appears to be missing an mcmod.info file", candidate.getModContainer().getName()); FMLLog.log.debug("The mod container {} appears to be missing an mcmod.info file", candidate.getModContainer().getName());
mc = MetadataCollection.from(null, ""); mc = MetadataCollection.from(null, "");
} }
for (ZipEntry ze : Collections.list(jar.entries())) for (ZipEntry ze : Collections.list(jar.entries()))
@ -97,7 +97,7 @@ public class JarDiscoverer implements ITypeDiscoverer
} }
catch (LoaderException e) catch (LoaderException e)
{ {
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()); FMLLog.log.error("There was a problem reading the entry {} in the jar {} - probably a corrupt zip", candidate.getModContainer().getPath(), e);
jar.close(); jar.close();
throw e; throw e;
} }
@ -116,7 +116,7 @@ public class JarDiscoverer implements ITypeDiscoverer
} }
catch (Exception e) catch (Exception e)
{ {
FMLLog.log(Level.WARN, e, "Zip file %s failed to read properly, it will be ignored", candidate.getModContainer().getName()); FMLLog.log.warn("Zip file {} failed to read properly, it will be ignored", candidate.getModContainer().getName(), e);
} }
finally finally
{ {

View File

@ -78,7 +78,7 @@ public class ModCandidate
this.mods = sourceType.findMods(this, table); this.mods = sourceType.findMods(this, table);
if (!baseModCandidateTypes.isEmpty()) if (!baseModCandidateTypes.isEmpty())
{ {
FMLLog.info("Attempting to reparse the mod container %s", getModContainer().getName()); FMLLog.log.info("Attempting to reparse the mod container {}", getModContainer().getName());
this.mods = sourceType.findMods(this, table); this.mods = sourceType.findMods(this, table);
} }
return this.mods; return this.mods;

View File

@ -61,7 +61,7 @@ public class ModDiscoverer
File[] minecraftSources = modClassLoader.getParentSources(); File[] minecraftSources = modClassLoader.getParentSources();
if (minecraftSources.length == 1 && minecraftSources[0].isFile()) if (minecraftSources.length == 1 && minecraftSources[0].isFile())
{ {
FMLLog.fine("Minecraft is a file at %s, loading", minecraftSources[0].getAbsolutePath()); FMLLog.log.debug("Minecraft is a file at {}, loading", minecraftSources[0].getAbsolutePath());
addCandidate(new ModCandidate(minecraftSources[0], minecraftSources[0], ContainerType.JAR, true, true)); addCandidate(new ModCandidate(minecraftSources[0], minecraftSources[0], ContainerType.JAR, true, true));
} }
else else
@ -73,17 +73,17 @@ public class ModDiscoverer
{ {
if (knownLibraries.contains(source.getName()) || modClassLoader.isDefaultLibrary(source)) if (knownLibraries.contains(source.getName()) || modClassLoader.isDefaultLibrary(source))
{ {
FMLLog.finer("Skipping known library file %s", source.getAbsolutePath()); FMLLog.log.trace("Skipping known library file {}", source.getAbsolutePath());
} }
else else
{ {
FMLLog.fine("Found a minecraft related file at %s, examining for mod candidates", source.getAbsolutePath()); FMLLog.log.debug("Found a minecraft related file at {}, examining for mod candidates", source.getAbsolutePath());
addCandidate(new ModCandidate(source, source, ContainerType.JAR, i==0, true)); addCandidate(new ModCandidate(source, source, ContainerType.JAR, i==0, true));
} }
} }
else if (minecraftSources[i].isDirectory()) else if (minecraftSources[i].isDirectory())
{ {
FMLLog.fine("Found a minecraft related directory at %s, examining for mod candidates", source.getAbsolutePath()); FMLLog.log.debug("Found a minecraft related directory at {}, examining for mod candidates", source.getAbsolutePath());
addCandidate(new ModCandidate(source, source, ContainerType.DIR, i==0, true)); addCandidate(new ModCandidate(source, source, ContainerType.DIR, i==0, true));
} }
i++; i++;
@ -106,11 +106,11 @@ public class ModDiscoverer
// skip loaded coremods // skip loaded coremods
if (CoreModManager.getIgnoredMods().contains(modFile.getName())) if (CoreModManager.getIgnoredMods().contains(modFile.getName()))
{ {
FMLLog.finer("Skipping already parsed coremod or tweaker %s", modFile.getName()); FMLLog.log.trace("Skipping already parsed coremod or tweaker {}", modFile.getName());
} }
else if (modFile.isDirectory()) else if (modFile.isDirectory())
{ {
FMLLog.fine("Found a candidate mod directory %s", modFile.getName()); FMLLog.log.debug("Found a candidate mod directory {}", modFile.getName());
addCandidate(new ModCandidate(modFile, modFile, ContainerType.DIR)); addCandidate(new ModCandidate(modFile, modFile, ContainerType.DIR));
} }
else else
@ -119,12 +119,12 @@ public class ModDiscoverer
if (matcher.matches()) if (matcher.matches())
{ {
FMLLog.fine("Found a candidate zip or jar file %s", matcher.group(0)); FMLLog.log.debug("Found a candidate zip or jar file {}", matcher.group(0));
addCandidate(new ModCandidate(modFile, modFile, ContainerType.JAR)); addCandidate(new ModCandidate(modFile, modFile, ContainerType.JAR));
} }
else else
{ {
FMLLog.fine("Ignoring unknown file %s in mods directory", modFile.getName()); FMLLog.log.debug("Ignoring unknown file {} in mods directory", modFile.getName());
} }
} }
} }
@ -150,7 +150,7 @@ public class ModDiscoverer
} }
catch (LoaderException le) catch (LoaderException le)
{ {
FMLLog.log(Level.WARN, le, "Identified a problem with the mod candidate %s, ignoring this source", candidate.getModContainer()); FMLLog.log.warn("Identified a problem with the mod candidate {}, ignoring this source", candidate.getModContainer(), le);
} }
catch (Throwable t) catch (Throwable t)
{ {
@ -177,7 +177,7 @@ public class ModDiscoverer
{ {
if (c.getModContainer().equals(candidate.getModContainer())) if (c.getModContainer().equals(candidate.getModContainer()))
{ {
FMLLog.finer(" Skipping already in list %s", candidate.getModContainer()); FMLLog.log.trace(" Skipping already in list {}", candidate.getModContainer());
return; return;
} }
} }

View File

@ -65,7 +65,7 @@ public class ASMModParser
} }
catch (Exception ex) catch (Exception ex)
{ {
FMLLog.log(Level.ERROR, ex, "Unable to read a class file correctly"); FMLLog.log.error("Unable to read a class file correctly", ex);
throw new LoaderException(ex); throw new LoaderException(ex);
} }
} }

View File

@ -63,7 +63,7 @@ public class FMLInterModComms {
{ {
this.activeContainer = activeContainer; this.activeContainer = activeContainer;
this.currentList = null; this.currentList = null;
FMLLog.finer("Attempting to deliver %d IMC messages to mod %s", modMessages.get(activeContainer.getModId()).size(), activeContainer.getModId()); FMLLog.log.trace("Attempting to deliver {} IMC messages to mod {}", modMessages.get(activeContainer.getModId()).size(), activeContainer.getModId());
} }
private ImmutableList<IMCMessage> currentList; private ImmutableList<IMCMessage> currentList;
@ -192,7 +192,7 @@ public class FMLInterModComms {
Function<T,V> f = Class.forName((String) value).asSubclass(Function.class).newInstance(); Function<T,V> f = Class.forName((String) value).asSubclass(Function.class).newInstance();
return Optional.of(f); return Optional.of(f);
} catch (Exception e) { } catch (Exception e) {
FMLLog.getLogger().log(Level.INFO, "An error occurred instantiating the IMC function. key: {} value: {}, caller: {}", key,value,sender); FMLLog.log.info("An error occurred instantiating the IMC function. key: {} value: {}, caller: {}", key,value,sender);
return Optional.absent(); return Optional.absent();
} }
} }

View File

@ -81,7 +81,7 @@ public class FMLPostInitializationEvent extends FMLStateEvent
} }
catch (Exception e) catch (Exception e)
{ {
FMLLog.getLogger().log(Level.INFO, "An error occurred trying to build a soft depend proxy",e); FMLLog.log.info("An error occurred trying to build a soft depend proxy", e);
return Optional.absent(); return Optional.absent();
} }
} }

View File

@ -73,7 +73,7 @@ public class EventBus implements IEventExceptionHandler
ModContainer activeModContainer = Loader.instance().activeModContainer(); ModContainer activeModContainer = Loader.instance().activeModContainer();
if (activeModContainer == null) if (activeModContainer == null)
{ {
FMLLog.log(Level.ERROR, new Throwable(), "Unable to determine registrant mod for %s. This is a critical error and should be impossible", target); FMLLog.log.error("Unable to determine registrant mod for {}. This is a critical error and should be impossible", target, new Throwable());
activeModContainer = Loader.instance().getMinecraftModContainer(); activeModContainer = Loader.instance().getMinecraftModContainer();
} }
listenerOwners.put(target, activeModContainer); listenerOwners.put(target, activeModContainer);
@ -196,11 +196,11 @@ public class EventBus implements IEventExceptionHandler
@Override @Override
public void handleException(EventBus bus, Event event, IEventListener[] listeners, int index, Throwable throwable) public void handleException(EventBus bus, Event event, IEventListener[] listeners, int index, Throwable throwable)
{ {
FMLLog.log(Level.ERROR, throwable, "Exception caught during firing event %s:", event); FMLLog.log.error("Exception caught during firing event {}:", event, throwable);
FMLLog.log(Level.ERROR, "Index: %d Listeners:", index); FMLLog.log.error("Index: {} Listeners:", index);
for (int x = 0; x < listeners.length; x++) for (int x = 0; x < listeners.length; x++)
{ {
FMLLog.log(Level.ERROR, "%d: %s", x, listeners[x]); FMLLog.log.error("{}: {}", x, listeners[x]);
} }
} }
} }

View File

@ -25,9 +25,9 @@ import java.util.List;
import net.minecraft.launchwrapper.ITweaker; import net.minecraft.launchwrapper.ITweaker;
import net.minecraft.launchwrapper.LaunchClassLoader; import net.minecraft.launchwrapper.LaunchClassLoader;
import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.relauncher.CoreModManager; import net.minecraftforge.fml.relauncher.CoreModManager;
import net.minecraftforge.fml.relauncher.FMLInjectionData; import net.minecraftforge.fml.relauncher.FMLInjectionData;
import net.minecraftforge.fml.relauncher.FMLRelaunchLog;
public class FMLDeobfTweaker implements ITweaker { public class FMLDeobfTweaker implements ITweaker {
@Override @Override
@ -49,13 +49,13 @@ public class FMLDeobfTweaker implements ITweaker {
classLoader.registerTransformer("net.minecraftforge.fml.common.asm.transformers.ItemStackTransformer"); classLoader.registerTransformer("net.minecraftforge.fml.common.asm.transformers.ItemStackTransformer");
try try
{ {
FMLRelaunchLog.fine("Validating minecraft"); FMLLog.log.debug("Validating minecraft");
Class<?> loaderClazz = Class.forName("net.minecraftforge.fml.common.Loader", true, classLoader); Class<?> loaderClazz = Class.forName("net.minecraftforge.fml.common.Loader", true, classLoader);
Method m = loaderClazz.getMethod("injectData", Object[].class); Method m = loaderClazz.getMethod("injectData", Object[].class);
m.invoke(null, (Object)FMLInjectionData.data()); m.invoke(null, (Object)FMLInjectionData.data());
m = loaderClazz.getMethod("instance"); m = loaderClazz.getMethod("instance");
m.invoke(null); m.invoke(null);
FMLRelaunchLog.fine("Minecraft validated, launching..."); FMLLog.log.debug("Minecraft validated, launching...");
} }
catch (Exception e) catch (Exception e)
{ {

View File

@ -49,7 +49,7 @@ public class Yggdrasil
} }
catch (AuthenticationException e) catch (AuthenticationException e)
{ {
LogManager.getLogger("FMLTWEAK").error("-- Login failed! " + e.getMessage()); LogManager.getLogger("FMLTWEAK").error("-- Login failed! {}", e.getMessage(), e);
Throwables.propagate(e); Throwables.propagate(e);
return; // don't set other variables return; // don't set other variables
} }

View File

@ -90,7 +90,7 @@ public abstract class FMLIndexedMessageToMessageCodec<A> extends MessageToMessag
ByteBuf payload = msg.payload().duplicate(); ByteBuf payload = msg.payload().duplicate();
if (payload.readableBytes() < 1) if (payload.readableBytes() < 1)
{ {
FMLLog.log(Level.ERROR, "The FMLIndexedCodec has received an empty buffer on channel %s, likely a result of a LAN server issue. Pipeline parts : %s", ctx.channel().attr(NetworkRegistry.FML_CHANNEL), ctx.pipeline().toString()); FMLLog.log.error("The FMLIndexedCodec has received an empty buffer on channel {}, likely a result of a LAN server issue. Pipeline parts : {}", ctx.channel().attr(NetworkRegistry.FML_CHANNEL), ctx.pipeline().toString());
} }
byte discriminator = payload.readByte(); byte discriminator = payload.readByte();
Class<? extends A> clazz = discriminators.get(discriminator); Class<? extends A> clazz = discriminators.get(discriminator);
@ -116,7 +116,7 @@ public abstract class FMLIndexedMessageToMessageCodec<A> extends MessageToMessag
@Override @Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception
{ {
FMLLog.log(Level.ERROR, cause, "FMLIndexedMessageCodec exception caught"); FMLLog.log.error("FMLIndexedMessageCodec exception caught", cause);
super.exceptionCaught(ctx, cause); super.exceptionCaught(ctx, cause);
} }
} }

View File

@ -59,7 +59,7 @@ public class NetworkEventFiringHandler extends SimpleChannelInboundHandler<FMLPr
@Override @Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception
{ {
FMLLog.log(Level.ERROR, cause, "NetworkEventFiringHandler exception"); FMLLog.log.error("NetworkEventFiringHandler exception", cause);
super.exceptionCaught(ctx, cause); super.exceptionCaught(ctx, cause);
} }
} }

View File

@ -226,7 +226,7 @@ public enum NetworkRegistry
ModContainer mc = FMLCommonHandler.instance().findContainerFor(mod); ModContainer mc = FMLCommonHandler.instance().findContainerFor(mod);
if (mc == null) if (mc == null)
{ {
FMLLog.log(Level.ERROR, "Mod of type %s attempted to register a gui network handler during a construction phase", mod.getClass().getName()); FMLLog.log.error("Mod of type {} 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"); throw new RuntimeException("Invalid attempt to create a GUI during mod construction. Use an EventHandler instead");
} }
serverGuiHandlers.put(mc, handler); serverGuiHandlers.put(mc, handler);

View File

@ -56,7 +56,7 @@ public class PacketLoggingHandler
{ {
PacketBuffer buf = new PacketBuffer(Unpooled.buffer()); PacketBuffer buf = new PacketBuffer(Unpooled.buffer());
msg.writePacketData(buf); msg.writePacketData(buf);
FMLLog.log(Level.DEBUG, "%s %s:\n%s", prefix, msg.getClass().getSimpleName(), ByteBufUtils.getContentDump(buf)); FMLLog.log.debug("{} {}:\n{}", prefix, msg.getClass().getSimpleName(), ByteBufUtils.getContentDump(buf));
ctx.fireChannelRead(msg); ctx.fireChannelRead(msg);
} }
}); });
@ -70,7 +70,7 @@ public class PacketLoggingHandler
{ {
PacketBuffer buf = new PacketBuffer(Unpooled.buffer()); PacketBuffer buf = new PacketBuffer(Unpooled.buffer());
((Packet<?>)msg).writePacketData(buf); ((Packet<?>)msg).writePacketData(buf);
FMLLog.log(Level.DEBUG, "%s %s:\n%s", prefix, msg.getClass().getSimpleName(), ByteBufUtils.getContentDump(buf)); FMLLog.log.debug("{} {}:\n{}", prefix, msg.getClass().getSimpleName(), ByteBufUtils.getContentDump(buf));
} }
ctx.write(msg, promise); ctx.write(msg, promise);
} }
@ -90,7 +90,7 @@ public class PacketLoggingHandler
{ {
ByteBuf pkt = (ByteBuf)itr.next(); ByteBuf pkt = (ByteBuf)itr.next();
pkt.markReaderIndex(); pkt.markReaderIndex();
FMLLog.log(Level.DEBUG, "%s:\n%s", prefix, ByteBufUtils.getContentDump(pkt)); FMLLog.log.debug("{}:\n{}", prefix, ByteBufUtils.getContentDump(pkt));
pkt.resetReaderIndex(); pkt.resetReaderIndex();
} }
} }
@ -102,7 +102,7 @@ public class PacketLoggingHandler
protected void encode(ChannelHandlerContext context, ByteBuf input, ByteBuf output) throws Exception protected void encode(ChannelHandlerContext context, ByteBuf input, ByteBuf output) throws Exception
{ {
input.markReaderIndex(); input.markReaderIndex();
FMLLog.log(Level.DEBUG, "%s:\n%s", prefix, ByteBufUtils.getContentDump(input)); FMLLog.log.debug("{}:\n{}", prefix, ByteBufUtils.getContentDump(input));
input.resetReaderIndex(); input.resetReaderIndex();
super.encode(context, input, output); super.encode(context, input, output);
} }

View File

@ -59,7 +59,7 @@ public class ChannelRegistrationHandler extends SimpleChannelInboundHandler<FMLP
@Override @Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception
{ {
FMLLog.log(Level.ERROR, cause, "ChannelRegistrationHandler exception"); FMLLog.log.error("ChannelRegistrationHandler exception", cause);
super.exceptionCaught(ctx, cause); super.exceptionCaught(ctx, cause);
} }
} }

View File

@ -72,7 +72,7 @@ enum FMLHandshakeClientState implements IHandshakeState<FMLHandshakeClientState>
} }
ServerHello serverHelloPacket = (FMLHandshakeMessage.ServerHello)msg; ServerHello serverHelloPacket = (FMLHandshakeMessage.ServerHello)msg;
FMLLog.info("Server protocol version %x", serverHelloPacket.protocolVersion()); FMLLog.log.info("Server protocol version {}", Integer.toHexString(serverHelloPacket.protocolVersion()));
if (serverHelloPacket.protocolVersion() > 1) if (serverHelloPacket.protocolVersion() > 1)
{ {
// Server sent us an extra dimension for the logging in player - stash it for retrieval later // Server sent us an extra dimension for the logging in player - stash it for retrieval later
@ -129,7 +129,7 @@ enum FMLHandshakeClientState implements IHandshakeState<FMLHandshakeClientState>
if (pkt.hasMore()) if (pkt.hasMore())
{ {
FMLLog.fine("Received Mod Registry mapping for %s: %d IDs %d subs %d dummied", pkt.getName(), entry.ids.size(), entry.substitutions.size(), entry.dummied.size()); FMLLog.log.debug("Received Mod Registry mapping for {}: {} IDs {} subs {} dummied", pkt.getName(), entry.ids.size(), entry.substitutions.size(), entry.dummied.size());
return WAITINGSERVERCOMPLETE; return WAITINGSERVERCOMPLETE;
} }
@ -140,8 +140,8 @@ enum FMLHandshakeClientState implements IHandshakeState<FMLHandshakeClientState>
{ {
NetworkDispatcher dispatcher = ctx.channel().attr(NetworkDispatcher.FML_DISPATCHER).get(); NetworkDispatcher dispatcher = ctx.channel().attr(NetworkDispatcher.FML_DISPATCHER).get();
dispatcher.rejectHandshake("Fatally missing blocks and items"); dispatcher.rejectHandshake("Fatally missing blocks and items");
FMLLog.severe("Failed to connect to server: there are %d missing blocks and items", locallyMissing.size()); FMLLog.log.fatal("Failed to connect to server: there are {} missing blocks and items", locallyMissing.size());
FMLLog.fine("Missing list: %s", locallyMissing); FMLLog.log.debug("Missing list: {}", locallyMissing);
return ERROR; return ERROR;
} }
ctx.writeAndFlush(new FMLHandshakeMessage.HandshakeAck(ordinal())).addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE); ctx.writeAndFlush(new FMLHandshakeMessage.HandshakeAck(ordinal())).addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE);

View File

@ -77,11 +77,11 @@ public abstract class FMLHandshakeMessage {
if (serverProtocolVersion > 1) if (serverProtocolVersion > 1)
{ {
overrideDimension = buffer.readInt(); overrideDimension = buffer.readInt();
FMLLog.fine("Server FML protocol version %d, 4 byte dimension received %d", serverProtocolVersion, overrideDimension); FMLLog.log.debug("Server FML protocol version {}, 4 byte dimension received {}", serverProtocolVersion, overrideDimension);
} }
else else
{ {
FMLLog.info("Server FML protocol version %d, no additional data received", serverProtocolVersion); FMLLog.log.info("Server FML protocol version {}, no additional data received", serverProtocolVersion);
} }
} }

View File

@ -57,14 +57,14 @@ enum FMLHandshakeServerState implements IHandshakeState<FMLHandshakeServerState>
// Hello packet first // Hello packet first
if (msg instanceof FMLHandshakeMessage.ClientHello) if (msg instanceof FMLHandshakeMessage.ClientHello)
{ {
FMLLog.info("Client protocol version %x", ((FMLHandshakeMessage.ClientHello)msg).protocolVersion()); FMLLog.log.info("Client protocol version {}", Integer.toHexString(((FMLHandshakeMessage.ClientHello)msg).protocolVersion()));
return this; return this;
} }
FMLHandshakeMessage.ModList client = (FMLHandshakeMessage.ModList)msg; FMLHandshakeMessage.ModList client = (FMLHandshakeMessage.ModList)msg;
NetworkDispatcher dispatcher = ctx.channel().attr(NetworkDispatcher.FML_DISPATCHER).get(); NetworkDispatcher dispatcher = ctx.channel().attr(NetworkDispatcher.FML_DISPATCHER).get();
dispatcher.setModList(client.modList()); dispatcher.setModList(client.modList());
FMLLog.info("Client attempting to join with %d mods : %s", client.modListSize(), client.modListAsString()); FMLLog.log.info("Client attempting to join with {} mods : {}", client.modListSize(), client.modListAsString());
String result = FMLNetworkHandler.checkModList(client, Side.CLIENT); String result = FMLNetworkHandler.checkModList(client, Side.CLIENT);
if (result != null) if (result != null)
{ {

View File

@ -44,9 +44,9 @@ public class HandshakeMessageHandler<S extends Enum<S> & IHandshakeState<S>> ext
protected void channelRead0(ChannelHandlerContext ctx, FMLHandshakeMessage msg) throws Exception protected void channelRead0(ChannelHandlerContext ctx, FMLHandshakeMessage msg) throws Exception
{ {
S state = ctx.attr(fmlHandshakeState).get(); S state = ctx.attr(fmlHandshakeState).get();
FMLLog.fine(stateType.getSimpleName() + ": " + msg.toString(stateType) + "->" + state.getClass().getName().substring(state.getClass().getName().lastIndexOf('.')+1)+":"+state); FMLLog.log.debug("{}: {}->{}:{}", stateType.getSimpleName(), msg.toString(stateType), state.getClass().getName().substring(state.getClass().getName().lastIndexOf('.')+1), state);
S newState = state.accept(ctx, msg); S newState = state.accept(ctx, msg);
FMLLog.fine(" Next: " + newState.name()); FMLLog.log.debug(" Next: {}", newState.name());
ctx.attr(fmlHandshakeState).set(newState); ctx.attr(fmlHandshakeState).set(newState);
} }
@ -59,16 +59,16 @@ public class HandshakeMessageHandler<S extends Enum<S> & IHandshakeState<S>> ext
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception
{ {
S state = ctx.attr(fmlHandshakeState).get(); S state = ctx.attr(fmlHandshakeState).get();
FMLLog.fine(stateType.getSimpleName() + ": null->" + state.getClass().getName().substring(state.getClass().getName().lastIndexOf('.')+1)+":"+state); FMLLog.log.debug("{}: null->{}:{}", stateType.getSimpleName(), state.getClass().getName().substring(state.getClass().getName().lastIndexOf('.')+1), state);
S newState = state.accept(ctx, null); S newState = state.accept(ctx, null);
FMLLog.fine(" Next: " + newState.name()); FMLLog.log.debug(" Next: {}", newState.name());
ctx.attr(fmlHandshakeState).set(newState); ctx.attr(fmlHandshakeState).set(newState);
} }
@Override @Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception
{ {
FMLLog.log(Level.ERROR, cause, "HandshakeMessageHandler exception"); FMLLog.log.error("HandshakeMessageHandler exception", cause);
super.exceptionCaught(ctx, cause); super.exceptionCaught(ctx, cause);
} }
} }

View File

@ -159,7 +159,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler<Packet<?>> im
else else
{ {
serverInitiateHandshake(); serverInitiateHandshake();
FMLLog.info("Connection received without FML marker, assuming vanilla."); FMLLog.log.info("Connection received without FML marker, assuming vanilla.");
this.completeServerSideConnection(ConnectionType.VANILLA); this.completeServerSideConnection(ConnectionType.VANILLA);
insertIntoChannel(); insertIntoChannel();
} }
@ -176,11 +176,11 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler<Packet<?>> im
// Insert ourselves into the pipeline // Insert ourselves into the pipeline
this.manager.channel().pipeline().addBefore("packet_handler", "fml:packet_handler", this); this.manager.channel().pipeline().addBefore("packet_handler", "fml:packet_handler", this);
if (this.state != null) { if (this.state != null) {
FMLLog.getLogger().log(Level.INFO, "Opening channel which already seems to have a state set. This is a vanilla connection. Handshake handler will stop now"); FMLLog.log.info("Opening channel which already seems to have a state set. This is a vanilla connection. Handshake handler will stop now");
this.manager.channel().config().setAutoRead(true); this.manager.channel().config().setAutoRead(true);
return; return;
} }
FMLLog.getLogger().log(Level.TRACE, "Handshake channel activating"); FMLLog.log.trace("Handshake channel activating");
this.state = ConnectionState.OPENING; this.state = ConnectionState.OPENING;
// send ourselves as a user event, to kick the pipeline active // send ourselves as a user event, to kick the pipeline active
this.handshakeChannel.pipeline().fireUserEventTriggered(this); this.handshakeChannel.pipeline().fireUserEventTriggered(this);
@ -243,7 +243,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler<Packet<?>> im
private void completeClientSideConnection(ConnectionType type) private void completeClientSideConnection(ConnectionType type)
{ {
this.connectionType = type; this.connectionType = type;
FMLLog.info("[%s] Client side %s connection established", Thread.currentThread().getName(), this.connectionType.name().toLowerCase(Locale.ENGLISH)); FMLLog.log.info("[{}] Client side {} connection established", Thread.currentThread().getName(), this.connectionType.name().toLowerCase(Locale.ENGLISH));
this.state = ConnectionState.CONNECTED; this.state = ConnectionState.CONNECTED;
MinecraftForge.EVENT_BUS.post(new FMLNetworkEvent.ClientConnectedToServerEvent(manager, this.connectionType.name())); MinecraftForge.EVENT_BUS.post(new FMLNetworkEvent.ClientConnectedToServerEvent(manager, this.connectionType.name()));
} }
@ -251,7 +251,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler<Packet<?>> im
private synchronized void completeServerSideConnection(ConnectionType type) private synchronized void completeServerSideConnection(ConnectionType type)
{ {
this.connectionType = type; this.connectionType = type;
FMLLog.info("[%s] Server side %s connection established", Thread.currentThread().getName(), this.connectionType.name().toLowerCase(Locale.ENGLISH)); FMLLog.log.info("[{}] Server side {} connection established", Thread.currentThread().getName(), this.connectionType.name().toLowerCase(Locale.ENGLISH));
this.state = ConnectionState.CONNECTED; this.state = ConnectionState.CONNECTED;
MinecraftForge.EVENT_BUS.post(new FMLNetworkEvent.ServerConnectionFromClientEvent(manager)); MinecraftForge.EVENT_BUS.post(new FMLNetworkEvent.ServerConnectionFromClientEvent(manager));
if (DEBUG_HANDSHAKE) if (DEBUG_HANDSHAKE)
@ -289,7 +289,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler<Packet<?>> im
} }
else else
{ {
FMLLog.info("Unexpected packet during modded negotiation - assuming vanilla or keepalives : %s", msg.getClass().getName()); FMLLog.log.info("Unexpected packet during modded negotiation - assuming vanilla or keepalives : {}", msg.getClass().getName());
} }
return false; return false;
} }
@ -314,7 +314,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler<Packet<?>> im
{ {
if (evt instanceof ConnectionType && side == Side.SERVER) if (evt instanceof ConnectionType && side == Side.SERVER)
{ {
FMLLog.info("Timeout occurred, assuming a vanilla client"); FMLLog.log.info("Timeout occurred, assuming a vanilla client");
kickVanilla(); kickVanilla();
} }
} }
@ -326,7 +326,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler<Packet<?>> im
private void kickWithMessage(String message) private void kickWithMessage(String message)
{ {
FMLLog.log(Level.ERROR, "Network Disconnect: %s", message); FMLLog.log.error("Network Disconnect: {}", message);
final TextComponentString TextComponentString = new TextComponentString(message); final TextComponentString TextComponentString = new TextComponentString(message);
if (side == Side.CLIENT) if (side == Side.CLIENT)
{ {
@ -551,7 +551,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler<Packet<?>> im
{ {
if (state == ConnectionState.CONNECTED) if (state == ConnectionState.CONNECTED)
{ {
FMLLog.severe("Attempt to double complete the network connection!"); FMLLog.log.fatal("Attempt to double complete the network connection!");
throw new FMLNetworkException("Attempt to double complete!"); throw new FMLNetworkException("Attempt to double complete!");
} }
if (side == Side.CLIENT) if (side == Side.CLIENT)
@ -571,7 +571,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler<Packet<?>> im
public void abortClientHandshake(String type) public void abortClientHandshake(String type)
{ {
FMLLog.log(Level.INFO, "Aborting client handshake \"%s\"", type); FMLLog.log.info("Aborting client handshake \"{}\"", type);
//FMLCommonHandler.instance().waitForPlayClient(); //FMLCommonHandler.instance().waitForPlayClient();
completeClientSideConnection(ConnectionType.valueOf(type)); completeClientSideConnection(ConnectionType.valueOf(type));
} }
@ -585,11 +585,11 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler<Packet<?>> im
// Mute the reset by peer exception - it's disconnection noise // Mute the reset by peer exception - it's disconnection noise
if (cause.getMessage() != null && cause.getMessage().contains("Connection reset by peer")) if (cause.getMessage() != null && cause.getMessage().contains("Connection reset by peer"))
{ {
FMLLog.log(Level.DEBUG, cause, "Muted NetworkDispatcher exception"); FMLLog.log.debug("Muted NetworkDispatcher exception", cause);
} }
else else
{ {
FMLLog.log(Level.ERROR, cause, "NetworkDispatcher exception"); FMLLog.log.error("NetworkDispatcher exception", cause);
} }
} }
super.exceptionCaught(ctx, cause); super.exceptionCaught(ctx, cause);
@ -608,11 +608,11 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler<Packet<?>> im
public void setOverrideDimension(int overrideDim) { public void setOverrideDimension(int overrideDim) {
this.overrideLoginDim = overrideDim; this.overrideLoginDim = overrideDim;
FMLLog.fine("Received override dimension %d", overrideDim); FMLLog.log.debug("Received override dimension {}", overrideDim);
} }
public int getOverrideDimension(SPacketJoinGame packetIn) { public int getOverrideDimension(SPacketJoinGame packetIn) {
FMLLog.fine("Overriding dimension: using %d", this.overrideLoginDim); FMLLog.log.debug("Overriding dimension: using {}", this.overrideLoginDim);
return this.overrideLoginDim != 0 ? this.overrideLoginDim : packetIn.getDimension(); return this.overrideLoginDim != 0 ? this.overrideLoginDim : packetIn.getDimension();
} }

View File

@ -141,7 +141,7 @@ public class EntitySpawnHandler extends SimpleChannelInboundHandler<FMLMessage.E
wc.addEntityToWorld(spawnMsg.entityId, entity); wc.addEntityToWorld(spawnMsg.entityId, entity);
} catch (Exception e) } catch (Exception e)
{ {
FMLLog.log(Level.ERROR, e, "A severe problem occurred during the spawning of an entity at ( " + spawnMsg.rawX + "," + spawnMsg.rawY + ", " + spawnMsg.rawZ +")"); FMLLog.log.error("A severe problem occurred during the spawning of an entity at ({}, {}, {})", spawnMsg.rawX, spawnMsg.rawY, spawnMsg.rawZ, e);
throw Throwables.propagate(e); throw Throwables.propagate(e);
} }
} }
@ -149,7 +149,7 @@ public class EntitySpawnHandler extends SimpleChannelInboundHandler<FMLMessage.E
@Override @Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception
{ {
FMLLog.log(Level.ERROR, cause, "EntitySpawnHandler exception"); FMLLog.log.error("EntitySpawnHandler exception", cause);
super.exceptionCaught(ctx, cause); super.exceptionCaught(ctx, cause);
} }
} }

View File

@ -183,7 +183,7 @@ public abstract class FMLMessage {
entity.getDataManager().writeEntries(pb); entity.getDataManager().writeEntries(pb);
} catch (IOException e) } catch (IOException e)
{ {
FMLLog.log(Level.FATAL,e,"Encountered fatal exception trying to send entity spawn data watchers"); FMLLog.log.fatal("Encountered fatal exception trying to send entity spawn data watchers", e);
throw Throwables.propagate(e); throw Throwables.propagate(e);
} }
buf.writeBytes(tmpBuf); buf.writeBytes(tmpBuf);
@ -235,7 +235,7 @@ public abstract class FMLMessage {
dataWatcherList = EntityDataManager.readEntries(new PacketBuffer(dat)); dataWatcherList = EntityDataManager.readEntries(new PacketBuffer(dat));
} catch (IOException e) } catch (IOException e)
{ {
FMLLog.log(Level.FATAL, e, "There was a critical error decoding the datawatcher stream for a mod entity."); FMLLog.log.fatal("There was a critical error decoding the datawatcher stream for a mod entity.", e);
throw Throwables.propagate(e); throw Throwables.propagate(e);
} }

View File

@ -112,7 +112,7 @@ public class FMLNetworkHandler
} }
else else
{ {
FMLLog.fine("Invalid attempt to open a local GUI on a dedicated server. This is likely a bug. GUI ID: %s,%d", mc.getModId(), modGuiId); FMLLog.log.debug("Invalid attempt to open a local GUI on a dedicated server. This is likely a bug. GUI ID: {},{}", mc.getModId(), modGuiId);
} }
} }
@ -158,7 +158,7 @@ public class FMLNetworkHandler
} }
else else
{ {
FMLLog.info("Rejecting connection %s: %s", side, rejects); FMLLog.log.info("Rejecting connection {}: {}", side, rejects);
return String.format("Mod rejections %s",rejects); return String.format("Mod rejections %s",rejects);
} }
} }

Some files were not shown because too many files have changed in this diff Show More