Is writing server log files to a database a good idea?

Thomas Owens picture Thomas Owens · Nov 14, 2008 · Viewed 27.5k times · Source

After reading an article about the subject from O'Reilly, I wanted to ask Stack Overflow for their thoughts on the matter.

Answer

Jon Skeet picture Jon Skeet · Nov 14, 2008

Write locally to disk, then batch insert to the database periodically (e.g. at log rollover time). Do that in a separate, low-priority process. More efficient and more robust...

(Make sure that your database log table contains a column for "which machine the log event came from" by the way - very handy!)