Suppress java util logging from 3rd party jar

前端 未结 3 1971
天命终不由人
天命终不由人 2021-01-16 21:38

I am getting tons of info log messages from a 3rd party jar in my eclipse console. Cracking open the jar I see that it uses java.util.logging. I would like to set the outpu

3条回答
  •  迷失自我
    2021-01-16 21:51

    Have you used JConsole to determine that:

    1. The VM Summary tab shows that the system property 'java.util.logging.config.file' is set.
    2. The MBean tab->java.util.logging->Operations->getLoggerLevel of blank (no value) returns WARNING.
    3. The MBean tab->java.util.logging->Attributes->LoggerNames contains the list of active 3rd party loggers which can be added to your list of things to disable. The loggers will only be listed if the executing code has created them. Anonymous loggers are not listed but, the default settings are inherited from the root logger.

    You can also add the following code to check that your config file is working:

        public static void main(String[] arg) throws Exception {
            String p = System.getProperty("java.util.logging.config.file");
            System.out.println(p);
            System.out.println(new File(p).length());
            System.out.println(Logger.getLogger("").getLevel());
        }
    

提交回复
热议问题