How Thread-Safe is NLog?

后端 未结 6 1959
慢半拍i
慢半拍i 2020-12-02 23:23

Well,

I have waited for days before deciding to post this issue, as I was not sure how to state this, resutling into a long detailed post. However, I think it is re

6条回答
  •  再見小時候
    2020-12-02 23:52

    By enumerating over a copy of the collection you can solve this problem. I made the following change to the NLog source and it seems to fix the problem:

    internal void GetTargetsByLevelForLogger(string name, IList rules, TargetWithFilterChain[] targetsByLevel, TargetWithFilterChain[] lastTargetsByLevel)
    {
       foreach (LoggingRule rule in rules.ToList())
       {
       ... 
    

提交回复
热议问题