Double printing "[NBTAPI]" to console
ShaneBeee opened this issue ยท 8 comments
I noticed when using this API, that "[NBTAPI]" is printed twice to console,
ex:
[14:28:20 INFO]: [NBTAPI] [NBTAPI] Found Spigot: v1_16_R1! Trying to find NMS support
[14:28:20 INFO]: [NBTAPI] [NBTAPI] NMS support 'MC1_16_R1' loaded!
[14:28:20 INFO]: [NBTAPI] [NBTAPI] Using the plugin 'PermissionsEx' to create a bStats instance!
I noticed this was happening due to this:
Getting the logger "NBTAPI"
But then also adding "NBTAPI" to logging messages:
Maybe an option here could be one of the following:
- Remove "NBTAPI" from the messages
- for the logger use
Bukkit.getLogger()
- Make the Logger not final, so a plugin implementing this API could change the logger to a logger of their choice.
I'll remove the legacy prefix from the message. The point of the logger was to use a correct logger and to get rid of the duplicated "[NBTAPI]" everywhere.
No wait, at least on the CI the prefix isn't duplicated. Do you maybe reconfigure the logger to print that prefix too?
Good to know that Paper changes the logger that way. I'll add the needed configurations to follow Paper's logging.
No I didn't configure the logger to do anything.
I literally just use the API for entities/items/block entities.
Yea but it looks like something changed the configuration of the logger(probably some other plugin), since in for example here everything looks fine. May be worth to add a logger configuration to the lib itself to print the prefix and then remove the hard-coded prefix everywhere.
I just wanted to re-suggest my earlier suggestion:
Make the Logger not final, so a plugin implementing this API could change the logger to a logger of their choice.
Currently I am using a fork of the plugin which I changed that field to public, allowing me to change the logger within my own plugin.
In my opinion it looks a little cleaner and better integrated into the plugin.
A friend of mine just came across this same issue, he is now using my fork as well, so he can customize the prefix in the message.
Making this field public I feel would help out a lot of devs using this API.
edit:
A better option might be using a setter, to prevent people from making it null.
Added the method to replace the logger. Technically doesn't fix the issue with the spigot and paper loggers looking different, but not sure how to tackle that in a good way currently.