Search code examples
loggingenterprise-library

EnterpriseLibrary


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?


Solution

  • 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/.