Documentation icon indicating copy to clipboard operation
Documentation copied to clipboard

Mod-specific Logger & Logger configuration setup

Open joazlazer opened this issue 8 years ago • 5 comments

Having a page in the documentation (likely in utilities) would be beneficial to let newer modders know about the proper way to use the Log4j API and use the mod-specific Logger that FML provides. Additionally, documentation on configuring the logging.properties file would be greatly appreciated.

joazlazer avatar Aug 05 '17 17:08 joazlazer

I don't think having Forge docs include stuff for the Log4j API (which IIRC includes the properties file) would be particularly useful. People should look at the Log4j documentation instead. I don't remember what the FML logger is but if it is actually different from Log4j that could be useful.

elifoster avatar Aug 05 '17 19:08 elifoster

Additionally, Minecraft uses log4j2, which does not use logging.properties. https://logging.apache.org/log4j/2.0/manual/configuration.html

kashike avatar Aug 05 '17 22:08 kashike

Interesting, FML javadoc says it uses logging.properties in FMLPreinitializationEvent so I thought it still did. That might need updating then.

/**
* Get a logger instance configured to write to the FML Log as a parent, identified by modid. Handy for mod logging!
* Configurations can be applied through the <code>config/logging.properties</code> file, specifying logging levels
* for your ModID. Use this!
*
* @return A logger
*/
public Logger getModLog() { ...

However, there is no documentation (that I can find) on where to put this file or what to put in it.

joazlazer avatar Aug 06 '17 00:08 joazlazer

That is, indeed, outdated. That was done 5 years ago before log4j2 was introduced.

kashike avatar Aug 06 '17 03:08 kashike

If you want to write a better comment, I can make a commit to fix it.

mezz avatar Aug 06 '17 03:08 mezz