-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check for explicitly set logger config before overwriting it #70
Check for explicitly set logger config before overwriting it #70
Conversation
This change allows users to utilize the `log4j2.configurationFile` system property for configuring the logging context to their liking. This property is read by log4j2 to find the configuration file it should load during initialization. Previously, setting this property only affected logging output during the boot stage (anything before launching Minecraft itself) due to the unconditional logger context reconfiguration. Tying this logic to the already existing system property used by log4j2 seemed the most logical, considering that this property is the only approachable way for specifying an alternative configuration in the first place.
That seems reasonable. @FiniteReality you also worked on this area, what do you think? |
Does this then use the vanilla logging configuration needed for the launcher to stop complaining? (If we hosted and provided one?) |
What are these launcher complaints? I never realized it was complaining. |
Look at the first line that the launcher outputs. It states that the logging configuration is missing and that it assumes plain text. |
I am not sure I understand this question. The |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks fine to me.
The topic of the vanilla launcher not being satisfied because of our differing logging configuration is for another issue/PR, since we really haven't digged into that topic well enough to tell what the vanilla launcher is looking for (such that it can't find it and therefore defaults to assuming plain-text), and what the proper solution is (if it entails modifying our logging configuration, or otherwise).
This PR is just so users (mod developers and perhaps end users?) can modify Log4J as needed through a configuration file, since the current way just reforcibly reconfigures Log4J using FML's logging configuration without exception.
I've just been informed, and I apologize I didn't catch this, that we didn't account for the fact that the vanilla Minecraft launcher supplies the logging configuration through the same-named system property, so at the moment (if we update FML in NeoForge without any other changes, and barring any other factors I may not have considered) vanilla's configuration would always override ours (as the system property would always be present in production). We have a couple of options, I think:
|
This is only partially possible; system properties specified on the command line get overwritten by ones later in the parameter list. The only way to compose them is to separate with commas, like
This would be nice in addition to my proposed changes. Specifying it early on in the commandline args means we have a sensible default that's easy for users and modders to override. |
I am sorry, I wasn't aware that the Vanilla Laincher uses the same system property. I only looked at this from the perspective of a mod developer and only tested the change in a dev environment. If I knew about this problem, I would have used another system property for this check. Something like |
See #75 for a potential solution. |
We're using the path filter mostly for filtering out resources / class from Minecraft jars. The basePath is important to unconditionally include certain resources from specific basepaths of the union filesystem (client-extra jar). Not having to do string matching on the basepath makes this more robust. p.s.: This change is also motivated by SJH normalizing the base path such that it becomes a relative path, but only on Linux. So, `/tmp/blah.jar` becomes `tmp/blah.jar`. Co-authored-by: Marc Hermans <[email protected]>
This change allows users to utilize the
log4j2.configurationFile
system property for configuring the logging context to their liking.This property is read by log4j2 to find the configuration file it should load during initialization. Previously, setting this property only affected logging output during the boot stage (anything before launching Minecraft itself) due to the unconditional logger context reconfiguration.
Tying this logic to the already existing system property used by log4j2 seemed the most logical, considering that this property is the only approachable way for specifying an alternative configuration in the first place.