Whats the overhead of creating a Log4j Logger

后端 未结 2 1429
半阙折子戏
半阙折子戏 2021-02-19 22:43

I have some webservices in my application and i want to log them to diferent files, based on the webservice name. For that i am creating loggers with

myLogger =          


        
2条回答
  •  隐瞒了意图╮
    2021-02-19 23:08

    Loggers are already cached by log4j using the default log repository (Hierarchy). In other words, it's just a hashtable lookup.

    However, in my experience you tend to make the logger static, so it only ends up being called once per class anyway.

提交回复
热议问题