Solved Disable Bukkit logging your plugin for you?

Discussion in 'Plugin Development' started by Mindlessmink, Aug 26, 2016.

Thread Status:
Not open for further replies.
  1. Hello there, This is kind of a question and or something like that. I'm sure a lot of people will be commenting on other peoples forum posts saying "No need to log your plugins, Bukkit does it for you" I totally disagree with this. I believe people should be allowed to log there own plugins, As it gives it a more custom feel to it, So I was wondering... Is there any way to disable Bukkit logging your plugin for you? Or replace it with your own logging, If so, Please reply with your knowledge, Thanks.
     
  2. Offline

    Zombie_Striker

    No, there is not. The loading, enabling, and disabling messages are all controlled by bukkit.

    The thing is, there is not need to log your own plugins. Only the server owner can look at the messages, and even still, there is no reason to read the logs unless a plugin is throwing an error.
     
  3. @Mindlessmink
    There isn't an easy CraftBukkit intended way to do that, no. But why do you want to do it?

    Anyways, the code that prints that statement looks like this:
    Code:java
    1. public void enablePlugin(Plugin plugin) {
    2. Validate.isTrue(plugin instanceof JavaPlugin, "Plugin is not associated with this PluginLoader");
    3. if(!plugin.isEnabled()) {
    4. plugin.getLogger().info("Enabling " + plugin.getDescription().getFullName());
    5. JavaPlugin jPlugin = (JavaPlugin)plugin;
    6. String pluginName = jPlugin.getDescription().getName();
    7. if(!this.loaders.containsKey(pluginName)) {
    8. this.loaders.put(pluginName, (PluginClassLoader)jPlugin.getClassLoader());
    9. }
    10. try {
    11. jPlugin.setEnabled(true);
    12. } catch (Throwable var5) {
    13. this.server.getLogger().log(Level.SEVERE, "Error occurred while enabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", var5);
    14. }
    15. this.server.getPluginManager().callEvent(new PluginEnableEvent(plugin));
    16. }
    17. }
    Now, as you can see, there are no checks specifically for that enable message, so the only real option would be to either using reflection, somehow preventing the "isEnabled" variable from returning false, or simply change the code internals using bytecode manipulation. Both are quite time consuming and hard, and considering it's for such a small cause, I'd avoid it.
     
  4. @Zombie_Striker I'm meaning posting public plugins on Bukkit / Spigot and people downloading them, It gives your plugin a more unique feel to it if there is a custom logger message. Just my opinion on the logging thing, I can see you disagree ^.^

    EDIT: @AlvinB Could you get the logger and get the message [PluginName] Enabled or whatever the logging message is and replace it with your own? Just thinking.
     
  5. Offline

    Zombie_Striker

    Nope. As he said, you would have to do bytecode manipulation, and since you want to have this show on other people's server, you would have to edit their jar files in order to change this, which you cant.

    The only way that I can think of where you can create your own "custom" messages would be if you just log your plugin twice, which just spams the console with messages and does not actually stop the other message from being printed.
     
  6. @Zombie_Striker Okay, I see lol. I wouldn't want to spam consoles with messages anyway, So I guess I'll mark this as Solved as it doesen't really matter too much. Thanks anyway both of you, Have a great day.

    OFFTOPIC:
    Just throwing this in real quick cause I can! Could you please recommend a Bukkit tutorial on (preferably on these forums) for creating custom Entitys? I've looked everywhere but can't seem to find one. But what do I know? I'm useless. If you don't want to find one it's fine, I'll sure I can survive, But thanks very much if you find one.

    Regards:

    - Mink
     
  7. Offline

    Zombie_Striker

  8. @Zombie_Striker best luck! It'd be cool if another thread of yours got posted on the front page, You are great at making tutorials. Thanks for the links as well.
     
Thread Status:
Not open for further replies.

Share This Page