Thread Safety of log4net

前端 未结 3 1434
傲寒
傲寒 2021-02-02 11:38

There seems to be some discussion on whether log4net is thread-safe, the consensus is that the framework is thread-safe, but appenders are not and need to be used correctly to a

3条回答
  •  花落未央
    2021-02-02 12:18

    According to this link, RollingFileAppender is thread safe (as far as logging is concerned). This is coming from one of the developers of log4net. He specifically says that locking like this is not required in your code:

    lock(logger)
    {
      logger.Info("Hello!");
    }
    

提交回复
热议问题