Logging from multiple processes to same file using Enterprise Library 4.1

后端 未结 4 1511
旧时难觅i
旧时难觅i 2021-02-15 12:23

I have several processes running concurrently that I want to log to the same file.

We have been using Enterprise Library 4.1 Logging Application Block (with a Roll

4条回答
  •  独厮守ぢ
    2021-02-15 12:47

    Sorry to say but the answer is no. The File TraceListeners lock the output file so only one TraceListener can log to a file.

    You can try other Trace Listeners that are not file based (e.g. Database, Event Log).

    Another option I can think of would be to write your own logging service (out of process) that would log to the file and accepts LogEntries. Then create a custom trace listener that sends a message to your service.

    It might not be a good idea since you would have a bit of custom development plus it could impact performance since it is an out of process call. Basically you are setting up your own simplified-pseudo-distributor-service.

提交回复
热议问题