Question Logging statically

  • After careful consideration and due to limited usage, we’ve made the decision to discontinue the PaperMC forums. Moving forward, we recommend using Hangar for plugin uploads, and for all other community discussions and support, please join us on Discord.

renvins

New member
Aug 15, 2023
3
0
1
20
Italy
That's definitely the worst way to get a static Logger (maybe)
but the only one I've figured out (just don't want to take JavaPlugin with me)

LOGGERs are static everywhere except for spigot xD
Java:
public final class TrySpigotPlugin extends JavaPlugin {

    private static Logger logger;

    @Override
    public void onEnable() {
        logger = getLogger();
    }

    @Override
    public void onDisable() {
    }
  
    public static Logger getLog() {
        return logger;
    }
}
 
Last edited:

electronicboy

Administrator
Staff member
Dec 11, 2021
321
18
68
28
If you’re going to do it like that, just store the component logger exposed from JavaPlugin