Skip to content

Commit

Permalink
Add code
Browse files Browse the repository at this point in the history
  • Loading branch information
makamys committed May 7, 2023
1 parent 8061c52 commit 067fe0e
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 25 deletions.
10 changes: 9 additions & 1 deletion project.gradle
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
// Put your project-specific buildscript code in this file
jar {
manifest {
attributes (
'FMLCorePlugin': 'io.github.legacymoddingmc.notenoughverbosity.NotEnoughVerbosity'
)
}
}

archivesBaseName = "+++" + archivesBaseName
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package io.github.legacymoddingmc.notenoughverbosity;

import java.util.Map;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.core.config.ConfigurationFactory;

import cpw.mods.fml.relauncher.IFMLLoadingPlugin;
import cpw.mods.fml.relauncher.IFMLLoadingPlugin.MCVersion;

@MCVersion("1.7.10")
public class NotEnoughVerbosity implements IFMLLoadingPlugin {

public static final Logger LOGGER = LogManager.getLogger("notenoughverbosity");

public NotEnoughVerbosity() {
reconfigureLog4j();
}

public static void reconfigureLog4j() {
org.apache.logging.log4j.spi.LoggerContext ctx = LogManager.getFactory().getContext(LogManager.class.getName(), net.minecraft.launchwrapper.Launch.classLoader.getClass().getClassLoader(), false);
if(System.getProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY) != null) {
if(ctx instanceof org.apache.logging.log4j.core.LoggerContext) {
System.clearProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY);
((org.apache.logging.log4j.core.LoggerContext)ctx).reconfigure();
LOGGER.info("Logger reconfigured.");
} else {
LOGGER.warn("Logger context is of unknown type " + ctx.getClass() + ", unable to reconfigure.");
}
} else {
LOGGER.info("Logger config system property is not set, not doing anything.");
}
}

@Override
public String[] getASMTransformerClass() {
return new String[0];
}

@Override
public String getModContainerClass() {
return null;
}

@Override
public String getSetupClass() {
return null;
}

@Override
public void injectData(Map<String, Object> data) {

}

@Override
public String getAccessTransformerClass() {
return null;
}
}

This file was deleted.

8 changes: 4 additions & 4 deletions src/main/resources/mcmod.info
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[
{
"modid": "${modid}",
"name": "Example Mod",
"description": "Example placeholder mod.",
"name": "NotEnoughVerbosity",
"description": "Forces log4j to use Forge's default logger config.",
"version": "${version}",
"mcversion": "${minecraft_version}",
"url": "",
"updateUrl": "",
"authorList": ["ExampleDude"],
"credits": "The Forge and FML guys, for making this example",
"authorList": ["makamys"],
"credits": "",
"logoFile": "",
"screenshots": [],
"dependencies": []
Expand Down

0 comments on commit 067fe0e

Please sign in to comment.