Startup Log Scan

Discussion in 'Spigot Plugin Development' started by redstonedesigner, Jun 8, 2017.

  1. Hi guys,
    I am 13 and starting out with Java and Spigot.

    The server owner that I am a helper on has asked me to code something that scans the log file after everything is loaded and sends messages to the console about what plugins had errors and what plugins failed to load.

    The output he has requested looks like this:

    I am a COMPLETE beginner and would appreciate some help!
  2. Wait, don't tell me they're running 104 plugins? :eek:
    • Agree Agree x 2
  3. As you a complete beginner you should start out with the basics first. I recommend you read through this as it will show you how to make a basic plugin and add events and commands. To do it may take you a while if you try to dive straight into making this plugin. Take your time and google, watch some videos (preferably not TheBCBroz)
  4. That's not it, what he wants is create a "llogger" like the one on the picture (which is just a text).
  5. Here is a way to detect exceptions.
  6. The best bet would be checking each logged line, instead of looking for all exceptions.
  7. That was a mock up.

    We run around 150 plugins!
  8. also it's Loaded not Loadded
  9. I did not make this.

    My server owner did!
  10. MiniDigger


    I would hook into minecrafts logger and add a filter to that to get all log messages.
    then you can check the log level and count how many plugins log warnings or servre messages.
    time calculation is rather simple. just use javas time api:
    LocalDateTime start = <-- put that onLoad
    Duration dur = Duration.between(start, <-- do that once everything is enabled.
    dur.getSeconds() <-- your seconds
  11. You could also install my plugin ErrorSink and get emails about errors immediately.

    If you want to do it yourself, just check my code, this is where I add an appender to the logger of Spigot. This appender gets called for each line logged to the console, so you can detect exceptions, store them and display them later.