Skip to content

Conversation

@uniformization
Copy link

You can now enable debug logging by running /playit logging enable and disable debug logging by using /playit logging disable. The plugin now uses SLF4J for logging.

Fixes #21

You can now enable debug logging by running `/playit logging enable` and disable debug logging by using `/playit logging disable`. The plugin now uses SLF4J for logging.

Fixes playit-cloud#21
@uniformization uniformization changed the title Implement /logging command and config to enable/disable debug logging Add /logging command and config to enable/disable debug logging Apr 4, 2023
@loriopatrick
Copy link
Contributor

This looks awesome! Thank you for putting it together. I'll plan on testing it locally tomorrow and if all looks good merging and pushing out a new release.

Copy link
Contributor

@loriopatrick loriopatrick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really close


public void debug(String format, Object... data) {
if (PlayitBukkit.hasDebugLogging()) {
LOGGER.debug("[" + className + "] " + format, data);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

most servers will not print debug logs, I think we should use LOGGER.info here so the log statements are printed. If hasDebugLogging is set to false we can use LOGGER.debug and it will use the server's overall settings.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really know if Spigot has it's own way to access the spigot.yml or server.properties file yet. Should I switch back to using Java's logger or write something to read the files directly?
image

Copy link
Contributor

@loriopatrick loriopatrick Apr 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we just do

if (PlayitBukkit.hasDebugLogging()) {
   LOGGER.info("[" + className + "] " + format, data);
} else {
   LOGGER.debug("[" + className + "] " + format, data);
}

Copy link
Author

@uniformization uniformization Apr 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we just do

if (PlayitBukkit.hasDebugLogging()) {
   LOGGER.info("[" + className + "] " + format, data);
} else {
   LOGGER.debug("[" + className + "] " + format, data);
}

Oh, if I were to use that approach, I would have to switch to Java's logger. I already wrote something to use the spigot.yml file directly. Ill just push what I have right now using SLF4J and please let me know if its good or if I should switch to Java's logger!

LOGGER.debug also strangely doesnt work, despite isDebugEnabled() in the logger being true.

@uniformization
Copy link
Author

@loriopatrick Any updates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Log level filtering

3 participants