Solved Disable console output for world loading

Discussion in 'Spigot Plugin Development' started by RandomRobinnnn, May 31, 2017.

Thread Status:
Not open for further replies.
  1. Hello again,

    I would like to know if it's possible to disable the giant output to the console when loading a world. It's about this message: upload_2017-5-31_14-42-59.png

    I could not really find anything about this anywhere. Also, I don't want to remove every message on it's own. Really just not worth the effort.

    Thank you for your time ^-^
     
  2. Well, have a boolean to check if You are loading a world. then create a log4j filter that checks if the boolean is true and if so, denies the console output of the usual world loading messages
     
  3. I found this when searching with your answer. Would something like this work? If so, should I put this in the onEnable?

    Thanks c:
     
  4. In spigot.yml, set verbose to false

    Code (Text):
    world-settings:
      default:
        verbose: false
     
  5. I would like to do this through a plugin though. Or did you mean modifying spigot.yml from the plugin itself?
     
  6. I thought you just wanted to stop that console spam, in which case you'd do it manually, once. The only reason to do it with a plugin is if sometimes you want the spam and sometimes not.
     
  7. The plugin I'm currently building creates quite a lot of worlds. I don't want it to ever notify / spam me when a new world gets created. I can do that myself with a single message to the console. Obviously, I don't want to configure my spigot.yml file for every server that's running this plugin. Or if I decide to share this plugin, I don't want people having to mess around in spigot.yml

    It's not that I'm creating a specific plugin for just that, because like you said, that would be a bit unnessecary
     
  8. Fixed by using the following code in the onEnable. It will block every all logging while generating is true, so make sure you toggle it to true and false as quick as possible:

    Code (Text):
    ((org.apache.logging.log4j.core.Logger) LogManager.getRootLogger()).addFilter(new Filter() {
                    @Override
                    public Result filter(LogEvent event) {
                        if (generating) {
                            return Result.DENY;
                        }
                        return null;
                    }

                    @Override
                    public Result getOnMatch() {
                        return null;
                    }

                    @Override
                    public Result getOnMismatch() {
                        return null;
                    }

                    @Override
                    public Result filter(org.apache.logging.log4j.core.Logger arg0, Level arg1, Marker arg2, String arg3,
                            Object... arg4) {
                        // TODO Auto-generated method stub
                        return null;
                    }

                    @Override
                    public Result filter(org.apache.logging.log4j.core.Logger arg0, Level arg1, Marker arg2, Object arg3,
                            Throwable arg4) {
                        // TODO Auto-generated method stub
                        return null;
                    }

                    @Override
                    public Result filter(org.apache.logging.log4j.core.Logger arg0, Level arg1, Marker arg2, Message arg3,
                            Throwable arg4) {
                        // TODO Auto-generated method stub
                        return null;
                    }
                });
     
  9. U r welcome :p and please close the thread since your issue was solved.
     
  10. Didn't even know that was a thing. Will do ^-^
     
Thread Status:
Not open for further replies.