Fix up logging and log4j configuration (#4802)

This commit is contained in:
mezz authored and GitHub committed 2018-03-17 18:41:16 -07:00
1 parent 5ace86da12
commit ae654edfc2
29 files changed
+308 -206

No files matched your search

@@ -992,7 +992,7 @@ public class FMLClientHandler implements IFMLSidedHandler
{
return;
}
Logger logger = LogManager.getLogger("TEXTURE ERRORS");
Logger logger = LogManager.getLogger("FML.TEXTURE_ERRORS");
logger.error(Strings.repeat("+=", 25));
logger.error("The following texture errors were found.");
Map<String,FallbackResourceManager> resManagers = ObfuscationReflectionHelper.getPrivateValue(SimpleReloadableResourceManager.class, (SimpleReloadableResourceManager)Minecraft.getMinecraft().getResourceManager(), "domainResourceManagers", "field_110548"+"_a");
@@ -25,6 +25,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import net.minecraftforge.fml.common.FMLLog;
import org.apache.logging.log4j.LogManager;
import javax.imageio.ImageIO;
@@ -59,7 +60,7 @@ public class FMLFileResourcePack extends FileResourcePack implements FMLContaine
{
if ("pack.mcmeta".equals(resourceName))
{
LogManager.getLogger(container.getName()).debug("Mod {} is missing a pack.mcmeta file, substituting a dummy one", container.getName());
FMLLog.log.debug("Mod {} is missing a pack.mcmeta file, substituting a dummy one", container.getName());
return new ByteArrayInputStream(("{\n" +
" \"pack\": {\n"+
" \"description\": \"dummy FML pack for "+container.getName()+"\",\n"+
@@ -25,6 +25,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import net.minecraftforge.fml.common.FMLLog;
import org.apache.logging.log4j.LogManager;
import javax.imageio.ImageIO;
@@ -64,7 +65,7 @@ public class FMLFolderResourcePack extends FolderResourcePack implements FMLCont
{
if ("pack.mcmeta".equals(resourceName))
{
LogManager.getLogger(container.getName()).debug("Mod {} is missing a pack.mcmeta file, substituting a dummy one", container.getName());
FMLLog.log.debug("Mod {} is missing a pack.mcmeta file, substituting a dummy one", container.getName());
return new ByteArrayInputStream(("{\n" +
" \"pack\": {\n"+
" \"description\": \"dummy FML pack for "+container.getName()+"\",\n"+
@@ -31,7 +31,7 @@ import java.io.File;
public class GuiErrorBase extends GuiErrorScreen
{
static final File minecraftDir = new File(Loader.instance().getConfigDir().getParent());
static final File clientLog = new File(minecraftDir, "logs/fml-client-latest.log");
static final File logFile = new File(minecraftDir, "logs/latest.log");
public GuiErrorBase()
{
super(null, null);
@@ -48,7 +48,7 @@ public class GuiErrorBase extends GuiErrorScreen
super.initGui();
this.buttonList.clear();
this.buttonList.add(new GuiButton(10, 50, this.height - 38, this.width / 2 - 55, 20, translateOrDefault("fml.button.open.mods.folder", "Open Mods Folder")));
String openFileText = translateOrDefault("fml.button.open.file", "Open %s", clientLog.getName());
String openFileText = translateOrDefault("fml.button.open.file", "Open %s", logFile.getName());
this.buttonList.add(new GuiButton(11, this.width / 2 + 5, this.height - 38, this.width / 2 - 55, 20, openFileText));
}
@@ -71,11 +71,11 @@ public class GuiErrorBase extends GuiErrorScreen
{
try
{
Desktop.getDesktop().open(clientLog);
Desktop.getDesktop().open(logFile);
}
catch (Exception e)
{
FMLLog.log.error("Problem opening log file {}", clientLog, e);
FMLLog.log.error("Problem opening log file {}", logFile, e);
}
}
}
@@ -61,7 +61,7 @@ public class GuiModsMissing extends GuiErrorBase
this.drawCenteredString(this.fontRenderer, String.format(TextFormatting.BOLD + "%s" + TextFormatting.RESET + " : %s", v.getLabel(), v.getRangeString()), this.width / 2, offset, 0xEEEEEE);
}
offset+=20;
String seeLogText = I18n.format("fml.messages.mod.missing.dependencies.see.log", GuiErrorBase.clientLog.getName());
String seeLogText = I18n.format("fml.messages.mod.missing.dependencies.see.log", GuiErrorBase.logFile.getName());
this.drawCenteredString(this.fontRenderer, seeLogText, this.width / 2, offset, 0xFFFFFF);
super.drawScreen(mouseX, mouseY, partialTicks);
}
@@ -44,7 +44,7 @@ public class GuiWrongMinecraft extends GuiErrorBase
offset+=15;
this.drawCenteredString(this.fontRenderer, I18n.format("fml.messages.mod.wrongminecraft.fix", wrongMC.mod.getName()),this.width/2, offset, 0xFFFFFF);
offset+=20;
this.drawCenteredString(this.fontRenderer, I18n.format("fml.messages.mod.missing.dependencies.see.log", GuiErrorBase.clientLog.getName()), this.width / 2, offset, 0xFFFFFF);
this.drawCenteredString(this.fontRenderer, I18n.format("fml.messages.mod.missing.dependencies.see.log", GuiErrorBase.logFile.getName()), this.width / 2, offset, 0xFFFFFF);
super.drawScreen(mouseX, mouseY, partialTicks);
}
}