Something to note about plugin.getLogger()

Discussion in 'Plugin Development' started by desht, Feb 21, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    desht

    Just an FYI, something that threw me for a bit until I worked out what was going on...

    plugin.getLogger() is a recent and useful addition to the API, giving a logger with your plugin name automatically prepended. However, there's a little gotcha if you want to change the default log level of this logger.

    If you use plugin.getLogger.setLevel(Level.FINE), you might expect all log messages with level FINE or higher to start appearing in your server log, right? Wrong.

    The plugin-specific logger just passes its messages to its parent logger, which is the logger returned by Bukkit.getServer().getLogger(). So you'll need to either do plugin.getLogger().getParent().setLevel(), or Bukkit.getServer().getLogger().setLevel().
     
    sorklin, ferrybig and Don Redhorse like this.
Thread Status:
Not open for further replies.

Share This Page