Question How to set logging level in Paper?

Cardstock6349

New member
Aug 29, 2022
2
0
1
Hi all, I'm developing a plugin and I wanted to log some "DEBUG" level information to the console so that I could see what's going on during development without using INFO and having consumers of the plugin see these messages which will very likely be useless to them.

I looked a bit online but I couldn't find no clear way of setting the logging level to DEBUG/TRACE/FINEST. It actually seems a pain point in the community, some examples:


Is there a straightforward way of setting the log level to DEBUG? I'm running Paper version 1.19.2 (build 132).

Thanks!
 

electronicboy

Administrator
Staff member
Dec 11, 2021
118
8
23
18
Logging levels are generally a pain in the ass because nothing really uses the logger stuff properly, and so the way they're setup is pretty bleh; easy method is generally to use a custom log4j config (extract the one from the patched paper jar) and set the logging level properly, otherwise, you'd need to basically run around and manually set the correct level through the log manager API, so that you can set the correct level for the filters, etc
 
  • Like
Reactions: Cardstock6349

Cardstock6349

New member
Aug 29, 2022
2
0
1
Logging levels are generally a pain in the ass because nothing really uses the logger stuff properly, and so the way they're setup is pretty bleh; easy method is generally to use a custom log4j config (extract the one from the patched paper jar) and set the logging level properly, otherwise, you'd need to basically run around and manually set the correct level through the log manager API, so that you can set the correct level for the filters, etc

I see, thanks a lot @electronicboy . I think it might be easier to just create my own wrapper around the root logging functionality and have it decide whether to log "debug" messages or not depending on the value of an environment variable :) They would still get logged on the INFO level, but at least I can hide them from end users.