Solved Setting the Bukkit log level

Discussion in 'Plugin Development' started by ksick, Nov 25, 2020.

  1. Offline

    ksick

    I'm using Bukkits PluginLogger to log messages (but also tried everything of the things written below with Bukkit.getLogger() and getServer().getLogger()). My goal is to change the log level of the logger to Level.FINE.

    Things I tried:
    1. Setting the log level programmatically by calling logger.setLevel(Level.FINE)
    2. Setting the log level programmatically (same code as in point 1) for the PluginLogger, which is returned by getLogger() and all it's parent loggers and their handlers.
    3. Creating a custom logging.properties file and using it with java -Djava.util.logging.config.file="logging.properties" -jar spigot-1.16.4.jar with the below pasted content. At this approach I was not sure about the handler names but I came up with the ForwardLogHandler name by printing all handlers to the console this was the name of the handler of the root logger. I took the TerminalConsoleHandler name from this thread.
    Unfortunately none of the approaches worked, so any help would be highly appreciated - thank you.

    PS: I know, that I could create a custom file handler, but I don't want to log to a custom file, I just want to look at the default logs in more detail.

    Code:
    ############################################################
    #      Global properties
    ############################################################
    .level = ALL
    
    ############################################################
    # Handler specific properties.
    # Describes specific configuration info for Handlers.
    ############################################################
    org.bukkit.craftbukkit.util.ForwardLogHandler.level = ALL
    org.bukkit.craftbukkit.v1_16_R3.util.ForwardLogHandler.level = ALL
    
    org.bukkit.craftbukkit.util.TerminalConsoleHandler.level = ALL
    org.bukkit.craftbukkit.v1_16_R3.util.TerminalConsoleHandler.level = ALL
    
    
    ############################################################
    # Facility specific properties.
    # Provides extra control for each logger.
    ############################################################
    
    # Default Bukkit logger
    Minecraft.level = ALL
    # RegionForSale
    Minecraft.BukkitPlugin.level = ALL
     
  2. Offline

    timtower Administrator Administrator Moderator

    @ksick Why do you want it? Don't think that the server will log more to be honest.
     
  3. Offline

    ksick

    Because I want to be able to use all log levels in my plugin. Why fo they exist if I can't use them @timtower?
     
  4. Offline

    timtower Administrator Administrator Moderator

    @ksick An API has been used, but not all features were required for Bukkit probably.
     
  5. Offline

    ksick

    Ok - thank you @timtower. Then I'll try to add my own Handler to get all logs. Should I post the solution here if others find this thread and have the same problem?
     
  6. Offline

    timtower Administrator Administrator Moderator

    @ksick Don't think that many people need so much logging to be honest.
    But you are always free to do so.
     
  7. Offline

    ksick

Share This Page