We are using Logging Application Block to log the incoming message details and any errors to SQL Database using CustomDatabaseTraceListener.
If the Logging database goes down, then the CustomDatabaseTraceListener raises an error event with Category “Logging Errors & Warnings”, which will be consumed by the Listener configured under special sources error.
Can we change the Category for the errors raised by CustomDatabaseTraceListener? We would like to configure a File based logging listener based on the Category we define for our CustomListener logging errors. Is this possible?
The answer is not really. Once a trace listener throws an exception then the normal processing is halted and flow moves to the Errors & Warnings trace listener(s) to log the error message and formatted original LogEntry using the trace listeners defined
there. There is no way to re-start the processing internally based on a new category.
The only thing you might be able to do is create a custom trace listener that re-logs a new LogEntry to the Logging Block but that doesn't seem like a great idea. Here are the issues:
o The original LogEntry is lost as a structured data -- it is onIy available as a formatted string
o Possibility for infinite loop
o Goes against the design of the block
These are not insurmountable but be aware.
Enterprise Library support engineer