Reputation: 429
I have configured logging to be done in a rolling log file and event log. However, what happens is if one fails, the second one don't succeed either. Is there a way I can configure EntLib to try both before failing?
Upvotes: 0
Views: 86
Reputation: 30401
The logging block detects failures based on category, not trace listener. So if one trace listener in a category fails, none of the trace listeners in that category will run from that point on.
Your best bet here is to split the two listeners out into separate categories.
Upvotes: 1
Reputation: 22655
The logic on processing the Trace Listeners is deep within the implementation of Enterprise Library so there is no built-in way to configure.
One alternative is to download the source code and make the changes that you want, rebuild and use that custom version of Enterprise Library.
Another approach would be to use Unity to inject custom code to add the additional logic to process multiple trace listeners if an error occurs. You'll have to recreate much of the Enterprise Library logic but you wouldn't have to directly modify Enterprise Library source. You can find the full details for the latter approach at http://randylevy.wordpress.com/2012/04/04/enterprise-library-logging-extensions-part-2/.
Upvotes: 1