I have 2 applications updating the same log file. I observred that it is creating a new file "****trace.log" in the same directory instead of updating the trace.log file. I feel this behaviour shown when the log file is used by one application and another
application will not have access to it? How to fix this issue. I am using Ent Lib v3.0. Is there any setting?
Thanks in advance.
This is typically what happens when a process writes to a file. It locks the file for exclusive access.
The easiest solution is to use two different files.
The other solution is to use the Distributor Service. You can find more detailed information on it in the documentation under
Logging Application Block -> Developing Using the Logging Application Block -> Using the Distributor Service
Here is a snippet from the documentation:
"Applications must often send log entries from multiple sources to a common destination. The Logging Application Block takes advantage of Windows Message Queuing (also known as MSMQ) to allow you to do this. By configuring multiple applications to use the same
message queue, you can process log entries at a central location.
To distribute log entries to a central destination, configure your application to write log entries to the Message Queuing trace listener. When the application sends a log entry to the Logging Application Block, it places the log entry on a Message Queuing
queue. The distributor service runs as a Windows service on either the same computer as the application or on a remote computer. It polls the queue to see if there are any log entries on it. The polling interval is determined by configuration."
Search this forum for Distributor Service as well because the discussion has come up recently.
Microsoft MVP C#