Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[1.8.9][Logger] Configuring personal logger through logging.properties

Featured Replies

Posted

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.

Squirrel ! Squirrel ! Squirrel !

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.

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.

  • Author

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?

Squirrel ! Squirrel ! Squirrel !

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.

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.

  • Author

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. :)

Squirrel ! Squirrel ! Squirrel !

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.