Assume I have the following categories: Debug, Information, Warning, Exception
Here's want I to achieve: Allow log entries go thru to be based on these categories, IFF there is an exception. However, I still have the ability to turn on/off Debug, when no exception occurs.
Is there anywhere I can do this via configuration?
Or I need to write a custom filter?
Let me just restate so we are on the same page:
You have 4 categories: Debug, Information, Warning, Exception. By default you only want the Exception category to be logged but you want the ability to enable the Debug category at runtime.
If that is the scenario then you can use the built-in category filter to do this. For example, you could deny all categories exception Exception in the XML configuration file:
<add type="Microsoft.Practices.EnterpriseLibrary.Logging.Filters.CategoryFilter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=220.127.116.11, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
categoryFilterMode="DenyAllExceptAllowed" name="Category Filter">
<add name="Exception" />
If you wanted to allow other categories you could add them to the categoryFilters.
Enterprise Library support engineer