McModLauncher / modlauncher

Java 21 mod launcher
Other
171 stars 47 forks source link

Change how logging works to make configuration easier #119

Open FiniteReality opened 1 year ago

FiniteReality commented 1 year ago

There was a short discussion in the NeoForged discord about ways that configuring logging could be made easier for mod developers and users, and this is roughly what came from that discussion.

It's not the cleanest code, but the main goal is to get feedback on the basic idea of configuring logging in this way.

For modders and users, general logging configuration should be done by the system properties under logging.*:

Configuring the nitty-gritty of logging consists of specifying one or more --loggingConfig parameters, which is a URI to a valid log4j configuration file. These are aggregated by ModLauncher and used to populate the logging configuration fairly early on in the startup path. I imagine NeoForge/FancyModLoader would want to specify a --loggingConfig parameter to configure their marker filter defaults, or to add their custom log appenders for the server console.

As for why I decided to put these changes into ModLauncher, I felt that centralising all configuration in a single place would be ideal, and doing it early on in the startup process means that we can ensure a reliable foundation for the entire lifecycle of a launched game.