<p>Okay, here's the scenario. I have a utility that processes tons of records, and enters information to the Database accordingly.</p>

<p>It works on these records in multi-threaded batches. Each such batch writes to the same log file for creating a workflow trace for each record. Potentially, we could be making close to a million log writes in a day.</p>

<p>Should this log be made into a database residing on another server? Considerations:</p>

<ol>
<li>The obvious disadvantage of multiple threads writing to the same log file is that the log messages are shuffled amongst each other. In the database, they can be grouped by batch id.</li>
<li>Performance - which would slow down the batch processing more? writing to a local file or sending log data to a database on another server on the same network. Theoretically, the log file is faster, but is there a gotcha here?</li>
</ol>

<p>Are there any optimizations that can be done on either approach?</p>

<p>Thanks.</p>

I think it depends greatly on what you are doing with the log files afterwards.
Of the two operations writing to the log file will be faster - especially as you are suggesting writing to a database on another server.
However if you are then trying to process and search the log files on a regular basis then the best place to do this would be a database.
If you use a logging framework like log4net they often provide simple config file based ways of redirecting input to file or database.