Thursday, July 9, 2009

database tables as log files

I have noticed over the years, a tendency of some developers to put logging information into database tables. Since the database is supposed to be the repository of corporate information and not a dumping ground, this is arguably not a good idea.

A better approach is to use flat files appropriate to your environment for logging. If you need them to be searchable either in or out of the application, then use a search engine technology (Lucene comes to mind) to index the log information and make it available to your consumers.


1 comment:

  1. Since when is a database supposed to be "the repository of corporate information", as opposed to a tool to be applied to whatever problems for which it's suitable?

    If logging data pose performance or storage issues for the database, or if they (might) need to be search-able in ways not best suited to a database, those are good reasons to put them elsewhere. But I'm sure there are some log "files" out there very well suited to a database's particular operational benefits (e.g. security, distribution).

    ReplyDelete