How can I disable the default console handler, while using the java logging API?

前端 未结 5 2036
天涯浪人
天涯浪人 2020-11-27 12:07

Hi I am trying to implement the java logging in my application. I want to use two handlers. A file handler and my own console handler. Both of my handlers work fine. My logg

5条回答
  •  春和景丽
    2020-11-27 12:29

    Do a reset of the configuration and set the root level to OFF

    LogManager.getLogManager().reset();
    Logger globalLogger = Logger.getLogger(java.util.logging.Logger.GLOBAL_LOGGER_NAME);
    globalLogger.setLevel(java.util.logging.Level.OFF);
    

提交回复
热议问题