You can use special sources Logging Errors & Warnings
as a fallback configuration.
Your configuration normally logs to a shared file trace listener. Additionally, when you configure a specialSource
for Logging Errors & Warnings
, it will first try to log to your shared file trace listener, if it fails, it will fallback to this flat file trace listener as you configured in Logging Errors & Warnings
section.
For example:
<specialSources>
<!-- other configurations related with unprocessed categories or all events can be placed here -->
....
<!-- this will be in action when an error occurs during logging -->
<errors switchValue="All" name="Logging Errors & Warnings">
<listeners>
<add name="Local File Trace Listener" />
</listeners>
</errors>
You can see here and here for more information.