I use a legacy library that writes logs using log4j. My default log4j.properties file directs the log to the console, but in some specific functions of my main program, I would
Perhaps like that:
Logger.getRootLogger().shutdown();