Major Squirrel Posted February 21, 2016 Share Posted February 21, 2016 Good morning, I would like to configure my own logger so that I can display some color into my console. I managed to get a Logger according to the FMLPreInitializationEvent : /** * 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() { Logger log = LogManager.getLogger(modContainer.getModId()); return log; } The doc tells us to configure through a logging.properties file. However, it seems that it doesn't take the file into account. This is the logging.properties file. Have you ever done this ? If yes, could you show me the way ? EDIT : sorry, forgot to tell --> using Windows & Intellij IDEA 15.0.3. I'm aware that IDEA console is independent, which requires a lil' plugin to work with colors. I'm just trying to do this on windows console. Quote Squirrel ! Squirrel ! Squirrel ! Link to comment Share on other sites More sharing options...
Choonster Posted February 21, 2016 Share Posted February 21, 2016 I'm pretty sure that doc comment is outdated, the method that loads logging configuration files was removed when Minecraft and Forge/FML switched to log4j from Java's Logging API. Quote Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future. Link to comment Share on other sites More sharing options...
Major Squirrel Posted February 21, 2016 Author Share Posted February 21, 2016 I'm pretty sure that doc comment is outdated, the method that loads logging configuration files was removed when Minecraft and Forge/FML switched to log4j from Java's Logging API. Hello Choonster, Does this mean that we can't configure our own Logger anymore? Quote Squirrel ! Squirrel ! Squirrel ! Link to comment Share on other sites More sharing options...
Choonster Posted February 21, 2016 Share Posted February 21, 2016 Hello Choonster, Does this mean that we can't configure our own Logger anymore? I'm not an expert on log4j, but I don't think it's possible to configure an individual Logger . You can include a log4j config file in your mod, but this overwrites the existing configuration provided by Forge. Quote Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future. Link to comment Share on other sites More sharing options...
Major Squirrel Posted February 21, 2016 Author Share Posted February 21, 2016 Hello Choonster, Does this mean that we can't configure our own Logger anymore? I'm not an expert on log4j, but I don't think it's possible to configure an individual Logger . You can include a log4j config file in your mod, but this overwrites the existing configuration provided by Forge. That's right ! For about 1 hour I did some tests : if you put a config file into the classpath (ex. the resources folder), the config is loaded automatically at start. Apparently, the version provided for FML is log4j 2.x which means that the config file must be called "log4j2". Sadly, I couldn't make it so that the config I provided does not overwrite Forge's config and goes on my own Logger ... (I work on console, not files) If someone succeeded on this task, I would be grateful to share the answer. Quote Squirrel ! Squirrel ! Squirrel ! Link to comment Share on other sites More sharing options...
Elix_x Posted February 21, 2016 Share Posted February 21, 2016 Interesting: http://mail-archives.apache.org/mod_mbox/logging-log4j-user/200203.mbox/%3CD054B0637615D611967000D0B78059CB025500@IBM3000%3E Quote Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.