Need to log to a database errors and file.

Topics: Logging Application Block
Jul 17, 2009 at 8:42 PM

Is there an application on how to log errors to an sql db and to a file at the same time.


Jul 20, 2009 at 7:46 AM


In order to make logging to a database, you must first run the .sql script that comes with the source code of the enterprise library. This can be found <Drive letter>\EntLib41Src\Blocks\Logging\Src\DatabaseTraceListener\Scripts ,.

In your config file, do the ff(using the config tool):

  1. Add a Logging Application Block.
  2. Add a category (optional, you may use the existing).
  3. Configure a connection string that will use the logging database that was created by running the script.
  4. Add a Database Trace listener and Flat File trace listener and configure their properties respectively.

We have a ASP.NET sample solution. Send us a mail and we'll send back the solution.

Valiant Dudan
Global Technology and Solutions
Avanade, Inc.