I’m using Microsoft Enterprise Library 5.0 for Exception Handling in asp.net. The errors are stored in the Event Viewer of the system. Instead of Event Viewer I need to store these errors in a log File (Text File) using Enterprise Library. How can I implement this?
I’m using Microsoft Enterprise Library 5.0 for Exception Handling in asp.net. The errors are
Share
I assume that you have a configuration like this for the event log:
Just replace that configuration with something for a flat file. E.g.:
And then change your categories to use the new “Flat File Trace Listener”. If you aren’t using the latest version then you would need to change the version above from 5.0.505.0 to 5.0.414.0.
Also, you can use the configuration tool
EntLibConfig.exeto simplify making these changes without worrying about the XML involved. Or use the config tool to generate the initial XML and then you can manually tweak the XML within your configuration file.Or, as another alternative, you can use the Fluent Configuration API to configure logging using code instead of configuration.