logging to database?

Topics: Logging Application Block
Dec 18, 2007 at 8:07 PM
hi,

i'm new here:) i'm trying to use ent lib 2.0 to log my logs to a database. i was looking for some configs and .. nothing ;/
my questions are:
1) how an sample logging app block should looks like?
2) how to setup a proper database?

best regards.
th.
Dec 19, 2007 at 2:30 PM
Hi,

Not sure I understand your question. Are you trying to use the existing capabilities or create new implementations? Assuming the former, here are the answers.


1) how an sample logging app block should looks like?

If by this you mean what the configuration for the existing capabilities should look like, you can look at the at the "Logging Application Block Properties" topic on the integrated help (at least that's the way it's called in the help for 3.1, and I think that hasn't changed). Also, the configuration tool will populate most of in settings with reasonable default values.


2) how to setup a proper database?

There's a script to do it, under Src\Logging\TraceListeners\Database\Scripts in the source tree.

Fernando
Dec 20, 2007 at 1:05 AM
hi,

thnx for answer.
1) config file -
before i started this topic ive checked help + configuration tool - but i have problems with understanding what should i do ;/ (im new in ent lib;/)

2) thnx.

th.
Dec 20, 2007 at 11:44 PM
From the help file:

Database TraceListener

  • AddCategoryStoredProcedure: The name of the stored procedure that adds a category. The default is AddCategory. This is required. leave the default
  • DatabaseInstance: The name of the database instance to use. The default is none. This is required. specify a connection string for the database where you created the logging db
  • Formatter: The formatter to use with this trace listener. Select from the drop-down list. The default is none. This is optional. leave the empty default, unless you want a specific formatting
  • Name: The name of the trace listener. The default is Database Trace Listener. This is required. leave the default, unless you want more than one db listener
  • TraceOutputOptions: A property used by trace listeners to determine which options, or elements, should be included in the trace output. Possible values are: CallStack, DateTime, LogicalOperationStack, None, ProcessId, ThreadId, and Timestamp. The default is None. For an explanation of these values, see the TraceOutputOptions Values table. This is optional. leave the default, unless you need extra information
  • WriteLogStoredProcedureName: The name of the stored procedure that writes the log entries. The default is WriteLog. This is required. leave the default

Dec 24, 2007 at 4:58 PM
Enterprise library 3.1 source code also comes with a SQL script to set up a logging database and create the stored proc's for you.