Logger.getLogger("Minecraft"); vs getServer().getLogger();

Discussion in 'Plugin Development' started by V10lator, Aug 27, 2011.

Thread Status:
Not open for further replies.
  1. All plugins I've looked at the sources are using Logger.getLogger("Minecraft"); but bukkit has the function getServer().getLogger(); - So why is everybody using the first one?
  2. Offline


    I use it, and I suspect other people may be the same, because Logger.getLogger("Minecraft"); is the one in the tutorial I used when I started out.
  3. Offline


    yah i started off with the first way and have evolved into using the second
  4. Offline


    lol isnt that the same
  5. Offline


    Some people made their own class so you don't have to pass a priority and can do something like "logger.warning("bla bla");" right away.
  6. I think so but why is there a bukkit function if it's so?
  7. Offline


    i dont know, it is easier than getLogger("minecraft");...
  8. But two functions doing exactly the same are confusing... :D
  9. I use getLogger("minecraft"); just because the tutorial said so. I never even knew of getServer().getLogger()
  10. Offline


    I may be worth noting that
    no longer appears to work now in 1.5, where as
    is still working.
  11. The latter (Bukkit.getLogger()) is actually the preferred one to use. For some reason in the very beginning some tutorial started the bad habit of using "Logger.getLogger("Minecraft")" and for some reason it stuck and everyone uses it now (including me until I've been informed of it).

    More or less official statement on it: http://forums.bukkit.org/posts/1469508/

    Why does the "bad" method exists? Well, basically because it's a plain Java method of retrieving a logger instance. A CraftBukkit server happens to call the global logger "Minecraft" (like the vanilla server), but it's as unofficial and volatile as net.minecraft.server code.

    TL;DR: Use the method provided by bukkit!
  12. Offline


    Thanks for that explanation. Looks like they either changed it from "Minecraft" OR otherwise prevented that unrecommended method from working in 1.5.
Thread Status:
Not open for further replies.

Share This Page