FallBack Mechanishm: using logging block for database,flat file...

Topics: Logging Application Block
Nov 11, 2010 at 9:34 AM

Hi All,

I have a situation, in which i want to log error into database,rolling flat file and event

log.

for instance, if application unable to log into database(using database tracelistener), then it should try to log into flat file(using rolling flat file tracelistener), if its also failed to log the error, then it must log the error into

event log.

 

Thanks
Ravi K Singh
mcamail2002@gmail.com

Nov 14, 2010 at 5:36 PM

Hi,

LAB has its own fallback mechanism but I'm afraid it will only applicable up to the 2nd level of your scenario. What I'm pertaining is the Special Category tracesources especially the Logging Errors and Warnings. What you're asking seems to be more an out of the box which LAB doesn't support directly as far as I know. The only approach I can think of is that creating your own custom trace listener for both database and flat file and make sure that in the Write method to specify the exception you would want to catch then if it throws an error (database) allow the next logging to execute (flat file) and if it throws again you can use the error and warning for the final logs. I'm not really sure if this meets your exact requirements but hope it somehow helps.

Gino Terrado
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com