Have been using JAudioTagger library for 2 years now , i can't figure out how to disable the Logger of it.
Also asked the owner of the project : https://bitbucket.org/ijabz/jaudiotagger/issues/257/how-to-disable-jaudio-tagger-logger
What i have tried ? ( No luck )
Logger.getLogger("org.jaudiotagger").setLevel(Level.OFF);
Logger.getLogger("org.jaudiotagger.tag").setLevel(Level.OFF);
Logger.getLogger("org.jaudiotagger.audio.mp3.MP3File").setLevel(Level.OFF);
Logger.getLogger("org.jaudiotagger.tag.id3.ID3v23Tag").setLevel(Level.OFF);
For now i just have disabled the Logger generally from the application , but i need it , what can i do ? The console is almost unusable because of tons of JAudioTagger messages .
Temporary Solution ( I need the logger for the application though ...)
LogManager.getLogManager().reset();
I have searched all the web , i can't find a solution like it's been 2 years ... that's why i ask here .
Solution 27/06/2018 For people interested :)
static {
//Disable loggers
pin = new Logger[]{ Logger.getLogger("org.jaudiotagger") };
for (Logger l : pin)
l.setLevel(Level.OFF);
}
You have to hold a strong reference to your loggers. Otherwise, your level change is ignored when the logger is garbage collected.
The logger name needs to match the logger used in JAudioTagger. You can find the logger names by viewing the source code. Otherwise, change the format of the
SimpleFormatter
to include the logger name which is%3$s
(the javadocs are off by one). When you run your program this will list the logger names you need to turn off.Use the formatter test program to ensure that you format property is configured correctly. Your pattern can be as simple as the pattern above or something with a little more detail like
%1$tH:%1$tM:%1$tS.%1$tL - [%3$s] -[%4$s] %5$s%n
Another option would be to add code to list all loggers just before your program exits.
JConsole can also list all of the active loggers.