Java Logging API generating empty log files

前端 未结 1 1795
春和景丽
春和景丽 2021-01-18 05:39

I tried to go through the tutorial on the Java logging API:

www.vogella.com/articles/Logging/article.html

But the generated files are empty (tested in Netbea

相关标签:
1条回答
  • 2021-01-18 06:22

    Change the following line (in the method de.vogella.logger.MyLogger.setup()):

    // Get the global logger to configure it
    Logger logger = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
    

    with:

    // Get the global logger to configure it
    Logger logger = Logger.getLogger("");
    

    See more:

    • Java Logging
    • Java Logging: Configuration
    • Java Logging Framework
    0 讨论(0)
提交回复
热议问题