Ent Library 4.1 - Database Logging quandry

Topics: Exception Handling Application Block, Logging Application Block
Sep 29, 2010 at 8:15 AM

Hi All,

I'm just attempting to get database logging up and running. At the moment, i'm having issues getting anything written at all to the table! For setup, i ran the sql script to create the tables and stored procedures in my own database (not the logging database).

I've then setup my Data Access block, exeption handling block, and my logging block. I was under the impression that once setup correctly, i'd just have to call .HandleException(ex, "Policy Name Here") to log to my chosen handler? This is how i use to do it when logging to a flat file sink.

However i read everywhere that you need to create a logentry and use the Logger.Write() method to actually write to the DB. This sort of doesn't make sense as i can't choose the exception policy.

I'm getting no exceptions what so ever and nothing is being written to the log table (with both HandleException or Logger.Write). I'm sort of at a loss here. If samples of my web.config are needed please let me know.

Sep 30, 2010 at 3:58 AM


Have you had the required stored procedure same with the (WriteLog, AddCategory and etc..) Entlib Logging database? See thread http://entlib.codeplex.com/Thread/View.aspx?ThreadId=208566 for some additional info and see if it may help you with your problem. HTH

Gino Terrado
Global Technology and Solutions
Avanade, Inc.

Sep 30, 2010 at 6:17 AM
Edited Sep 30, 2010 at 6:17 AM

Wow, it was a permissions issue!! I granted exec access to the three stored procs and now its writing to the log table!! I'm a bit concerned as to why no security related exception was being thrown but, cheers!

Sep 30, 2010 at 6:32 AM

There was no exception thrown because the Logging Application Block was designed to fail gracefully and not halt your program execution. 

Glad to know your problem is solved.


Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.

Sep 30, 2010 at 6:42 AM

No problem. So glad its up and running now. Now i just have to setup my different exception types etc


Thanks again everyone.