Whats the overhead of creating a Log4j Logger

后端 未结 2 1421
半阙折子戏
半阙折子戏 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条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-19 23:05

    This method Logger.getLogger(logKey) looks in logger cache for a logger with the name passed in logKey. If it doesn't exist it creates one. First call for a logger name, a Logger will be created but later calls will get it from cache so you don't need to handle this in your code.

提交回复
热议问题